Web Scale Architecture design
James Singh
1
Who is this targeted at?
Mostly Tech Startups
If you own a tech startup with brilliant idea and execution,
chances are that your startup will catch up like fire.
- Initial traffic from TNW, TechCrunch, HackerNews etc.
- Huge organic traffic
If you’re not prepared, bad things will happen.
2
Deliverables
We’ll go through iterative process building a
scalable[1] architecture for a website that we’ll
be launching (hypothetically) in sometime.
“Scalability is the ability of a system, network, or process to handle a growing
amount of work in a capable manner or its ability to be enlarged to
accommodate that growth.”
- Wikipedia
3
It all starts with the launch
Minimum Viable Product running on the following:
1. Amazon EC2 instance
2. MySQL database
4
Oops! You’ve hit the wall
- The server is showing 100% CPU Utilization. Need
more resources.
- Vertical scaling gives you sigh of relief.
5
Vertical Scalability ???
Increasing the hardware resources without changing the number
of nodes. Also known as "Scaling up" the server.
Advantages:
- Simple to implement
Disadvantages:
- Finite limit
- Requires downtime
6
Houston, we have a problem!
7
Horizontal scaling
Increasing the number of nodes of the App server through load
balancing. Also referred to as "Scaling out" the app server.
- Increase in the number of nodes by replacing the nodes.
- Each node performs the same tasks.
- Each node is identical.
8
1. Multiple AWS instances + Auto scaling
2. Elastic load balancing (ELB) / nginx
3. MySQL (master + slaves)
9
Doing good. Let’s work on performance
1. Not hitting the application server for static content
[Performance]
2. Take advantage of Content Delivery Networks (CDNs),
which copy the static assets to servers around the world
[Speed].
3. Render on the client side using templates. Return data
from server, as JSON/XML etc, rather than HTML.
[Performance+speed]
4. Returning compressed data from server. [Speed]
5. Caching data instead of hitting database every time
[Performance + Speed]
10
Our latest setup
1. Multiple AWS instances + Auto scaling
2. Elastic load balancing (ELB) / nginx
3. MySQL (master + slaves)
4. CDN / CloudFront / Akamai
5. Memcached
11
The database crunch!
The db has grown to the extent that a single machine
cannot hold all data.
Solution: NoSQL
Data spanning across multiple disks.
Options: MongoDB, Cassandra, Redis, CouchDB, Hbase,
Riak
12
Minimum viable setup??
1. Multiple AWS instances + Auto scaling
2. Elastic load balancing (ELB) / nginx
3. CDN / CloudFront / Akamai
4. Memcached
5. MongoDB
13
References
1. http://www.slideshare.net/directi/building-a-scalable-architecture-for-
web-apps
2. http://highscalability.com/blog/2013/4/15/scaling-pinterest-from-0-to-
10s-of-billions-of-page-views-a.html
3. http://architects.dzone.com/news/scalable-system-design-0
14
Questions?
15

Web scale architecture design

  • 1.
    Web Scale Architecturedesign James Singh 1
  • 2.
    Who is thistargeted at? Mostly Tech Startups If you own a tech startup with brilliant idea and execution, chances are that your startup will catch up like fire. - Initial traffic from TNW, TechCrunch, HackerNews etc. - Huge organic traffic If you’re not prepared, bad things will happen. 2
  • 3.
    Deliverables We’ll go throughiterative process building a scalable[1] architecture for a website that we’ll be launching (hypothetically) in sometime. “Scalability is the ability of a system, network, or process to handle a growing amount of work in a capable manner or its ability to be enlarged to accommodate that growth.” - Wikipedia 3
  • 4.
    It all startswith the launch Minimum Viable Product running on the following: 1. Amazon EC2 instance 2. MySQL database 4
  • 5.
    Oops! You’ve hitthe wall - The server is showing 100% CPU Utilization. Need more resources. - Vertical scaling gives you sigh of relief. 5
  • 6.
    Vertical Scalability ??? Increasingthe hardware resources without changing the number of nodes. Also known as "Scaling up" the server. Advantages: - Simple to implement Disadvantages: - Finite limit - Requires downtime 6
  • 7.
    Houston, we havea problem! 7
  • 8.
    Horizontal scaling Increasing thenumber of nodes of the App server through load balancing. Also referred to as "Scaling out" the app server. - Increase in the number of nodes by replacing the nodes. - Each node performs the same tasks. - Each node is identical. 8
  • 9.
    1. Multiple AWSinstances + Auto scaling 2. Elastic load balancing (ELB) / nginx 3. MySQL (master + slaves) 9
  • 10.
    Doing good. Let’swork on performance 1. Not hitting the application server for static content [Performance] 2. Take advantage of Content Delivery Networks (CDNs), which copy the static assets to servers around the world [Speed]. 3. Render on the client side using templates. Return data from server, as JSON/XML etc, rather than HTML. [Performance+speed] 4. Returning compressed data from server. [Speed] 5. Caching data instead of hitting database every time [Performance + Speed] 10
  • 11.
    Our latest setup 1.Multiple AWS instances + Auto scaling 2. Elastic load balancing (ELB) / nginx 3. MySQL (master + slaves) 4. CDN / CloudFront / Akamai 5. Memcached 11
  • 12.
    The database crunch! Thedb has grown to the extent that a single machine cannot hold all data. Solution: NoSQL Data spanning across multiple disks. Options: MongoDB, Cassandra, Redis, CouchDB, Hbase, Riak 12
  • 13.
    Minimum viable setup?? 1.Multiple AWS instances + Auto scaling 2. Elastic load balancing (ELB) / nginx 3. CDN / CloudFront / Akamai 4. Memcached 5. MongoDB 13
  • 14.
  • 15.