Computer Science S-75
Building Dynamic Websites
Harvard Extension School
[Link]
Lecture 9: Scalability
David J. Malan malan@[Link]
0
Web Hosts
Bluehost DreamHost Go Daddy Host Gator pair Networks
VPSes
DreamHost Go Daddy Host Gator Linode pair Networks Slicehost VPSLAND
2
Vertical Scaling
CPU
cores, L2 Cache, ...
Disk
PATA, SATA, SAS, ... RAID
RAM ...
Horizontal Scaling
Image from [Link].
PHP Acceleration
Code Optimization Opcode Caching ...
PHP Accelerators
Alternative PHP Cache (APC) [Link] eAccelerator [Link] XCache [Link] Zend Platform [Link] ...
Load Balancing
[Link]
Load Balancing with BIND
www www www www IN IN IN IN A A A A [Link] [Link] [Link] [Link]
Sticky Sessions
Shared Storage?
FC, iSCSI, MySQL, NFS, etc.
Cookies?
Load Balancers
Software
ELB HAProxy LVS ...
Hardware
Barracuda Cisco Citrix F5 ...
10
Caching
.html MySQL Query Cache memcached ...
11
.html
12
MySQL Query Cache
query_cache_type = 1
[Link]
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); }
[Link] [Link]
14
MySQL
[Link]
15
Replication: Master-Slave
Excerpted from High Performance MySQL.
16
Replication: Master-Master
Excerpted from High Performance MySQL.
17
Load Balancing + Replication
Excerpted from High Performance MySQL.
18
... + Partitioning
Excerpted from High Performance MySQL.
19
High Availability
Excerpted from High Performance MySQL.
20
Computer Science S-75
Building Dynamic Websites
Harvard Extension School
[Link]
Lecture 9: Scalability
David J. Malan malan@[Link]
21