Web scale architecture design


Published on

Published in: Technology, News & Politics

Web scale architecture design

  1. 1. Web Scale Architecture designJames Singh1
  2. 2. Who is this targeted at?Mostly Tech StartupsIf 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 trafficIf you’re not prepared, bad things will happen.2
  3. 3. DeliverablesWe’ll go through iterative process building ascalable[1] architecture for a website that we’llbe launching (hypothetically) in sometime.“Scalability is the ability of a system, network, or process to handle a growingamount of work in a capable manner or its ability to be enlarged toaccommodate that growth.”- Wikipedia3
  4. 4. It all starts with the launchMinimum Viable Product running on the following:1. Amazon EC2 instance2. MySQL database4
  5. 5. Oops! You’ve hit the wall- The server is showing 100% CPU Utilization. Needmore resources.- Vertical scaling gives you sigh of relief.5
  6. 6. Vertical Scalability ???Increasing the hardware resources without changing the numberof nodes. Also known as "Scaling up" the server.Advantages:- Simple to implementDisadvantages:- Finite limit- Requires downtime6
  7. 7. Houston, we have a problem!7
  8. 8. Horizontal scalingIncreasing the number of nodes of the App server through loadbalancing. 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. 9. 1. Multiple AWS instances + Auto scaling2. Elastic load balancing (ELB) / nginx3. MySQL (master + slaves)9
  10. 10. Doing good. Let’s work on performance1. 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 datafrom 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. 11. Our latest setup1. Multiple AWS instances + Auto scaling2. Elastic load balancing (ELB) / nginx3. MySQL (master + slaves)4. CDN / CloudFront / Akamai5. Memcached11
  12. 12. The database crunch!The db has grown to the extent that a single machinecannot hold all data.Solution: NoSQLData spanning across multiple disks.Options: MongoDB, Cassandra, Redis, CouchDB, Hbase,Riak12
  13. 13. Minimum viable setup??1. Multiple AWS instances + Auto scaling2. Elastic load balancing (ELB) / nginx3. CDN / CloudFront / Akamai4. Memcached5. MongoDB13
  14. 14. References1. http://www.slideshare.net/directi/building-a-scalable-architecture-for-web-apps2. http://highscalability.com/blog/2013/4/15/scaling-pinterest-from-0-to-10s-of-billions-of-page-views-a.html3. http://architects.dzone.com/news/scalable-system-design-014
  15. 15. Questions?15