0% found this document useful (0 votes)
79 views

Computer Science S-75: Building Dynamic Websites

This document discusses techniques for scaling websites, including using web hosts, virtual private servers (VPS), vertical scaling by improving individual server specs, horizontal scaling by adding more servers, PHP acceleration through opcode caching and accelerators, load balancing across servers using software or hardware load balancers, caching HTML, database queries, and content using memcached, MySQL query caching, database replication for performance and high availability, and partitioning data across multiple database servers. It provides examples of specific software and services for each technique.

Uploaded by

samyakmehta1234
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

Computer Science S-75: Building Dynamic Websites

This document discusses techniques for scaling websites, including using web hosts, virtual private servers (VPS), vertical scaling by improving individual server specs, horizontal scaling by adding more servers, PHP acceleration through opcode caching and accelerators, load balancing across servers using software or hardware load balancers, caching HTML, database queries, and content using memcached, MySQL query caching, database replication for performance and high availability, and partitioning data across multiple database servers. It provides examples of specific software and services for each technique.

Uploaded by

samyakmehta1234
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Computer Science S-75

Building Dynamic Websites


Harvard Extension School
https://www.cs75.net/

Lecture 9: Scalability
David J. Malan [email protected]
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 techhui.com.

PHP Acceleration

Code Optimization Opcode Caching ...

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

Load Balancing with BIND


www www www www IN IN IN IN A A A A 64.131.79.131 64.131.79.132 64.131.79.133 64.131.79.134

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

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

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
https://www.cs75.net/

Lecture 9: Scalability
David J. Malan [email protected]
21

You might also like