Computer Science S-75: Building Dynamic Websites
Computer Science S-75: Building Dynamic Websites
Lecture 9: Scalability
David J. Malan [email protected]
0
Web Hosts
VPSes
Vertical Scaling
CPU
Disk
PATA, SATA, SAS, ... RAID
RAM ...
Horizontal Scaling
PHP Acceleration
PHP Accelerators
Alternative PHP Cache (APC) http://pecl.php.net/package/APC eAccelerator http://eaccelerator.net/ XCache http://xcache.lighttpd.net/ Zend Platform http://www.zend.com/en/products/platform/ ...
Load Balancing
http://msdn.microsoft.com/en-us/library/ff648960.aspx
Sticky Sessions
Shared Storage?
FC, iSCSI, MySQL, NFS, etc.
Cookies?
Load Balancers
Software
ELB HAProxy LVS ...
Hardware
Barracuda Cisco Citrix F5 ...
10
Caching
11
.html
12
http://dev.mysql.com/doc/refman/5.1/en/query-cache.html
13
memcached
$memcache = memcache_connect(HOST, PORT); $user = memcache_get($memcache, $id); if (is_null($user)) { $dbh = new PDO(DSN, USER, PASS); $result = $dbh->query("SELECT * FROM users WHERE id=$id"); $user = $result->fetch(PDO:FETCH_ASSOC); memcache_set($memcache, $user['id'], $user); }
http://memcached.org/ http://www.php.net/memcache
14
MySQL
http://dev.mysql.com/doc/refman/5.5/en/storage-engines.html
15
Replication: Master-Slave
16
Replication: Master-Master
17
18
... + Partitioning
19
High Availability
20
Lecture 9: Scalability
David J. Malan [email protected]
21