Top4top Showcase


Published on

A showcase for higher payloads.

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Top4top Showcase

  1. 1. Scaling for Higher Payload
  2. 2. should be able to sustain 1,000,000 visitors daily, if need be. But we don’t need to spend money to sustain payload we don’t have.
  3. 3. Goal Normal day Rainy day A single $70/month Amazon server. At least 100,000 users with 500,000 pv daily. Average pageload time— 50 ms. Lots of Amazon servers. At least 1,000,000 users with 5,000,000 pv daily. Average pageload time— 50 ms.
  4. 4. Normal Day
  5. 5. Normal Day // Cache 1 day 10 minutes 1 day 1 day 5 minutes 10 min Different blocks have different cache renewal intervals. Naturally, any of these blocks is also updated whenever its content is updated.
  6. 6. Normal Day // Cache
  7. 7. Normal Day // Cache Administrators should be able to edit posts in this block. Thus, no caching for administrators here.
  8. 8. Normal Day // Cache
  9. 9. Let’s Test It! Normal day, 1 server in Ireland, the client is 10 hops away on a 10 Mbit channel
  10. 10. Normal Day // Infrastructure nginx apache + passenger rails mySQL memcache Nginx takes clients’ requests & serves static stuff: images, css, js. By default nginx balances to its own apache Passenger launches new instances of rails daemons if need be.
  11. 11. Normal Day // Even Faster nginx is used to serve static stuff, meaning 253 kilobytes of 260 kilobytes for the homepage. Only 7 kilobytes are served deeper than that. apache + passenger launches rails instances to certain limit. After that we switch to the ‘Rainy Day’ mode. gzip’d All texts, scripts are gzipped and are served this way to the clients that are able to comply. exprs All files and images have their ‘expires’ headers set to distant future. ETags Whenever a client asks for a not modified page, it gets ‘304 Not Modified’ and the page is being served from cache. rn Some of the static is served using the same server, but different filenames for a client to be able to download more than two files simultaneously.
  12. 12. Normal Day // Homepage Traffic
  13. 13. Normal Day // nginx config
  14. 14. Normal Day // nginx config
  15. 15. Normal Day // nginx config
  16. 16. Rainy Day
  17. 17. Rainy Day // Infrastructure After certain limit, the base nginx starts to balance across several servers, each of which runs the very same application, deployed via cloning. It’s cloud computing, baby!
  18. 18. Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger apache + passenger
  19. 19. Rainy Day // Infrastructure If it’s not enough, the main server begins to serve as base only, shutting down its own apache.
  20. 20. Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger
  21. 21. Rainy Day // Infrastructure The final step is to isolate MySQL. Now we’re able to serve millions of pageviews for $350 per month.
  22. 22. Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger MySQL
  23. 23. Rainy Day // Cloning top4top top4top-1 top4top-2 top4top-3 3 additional servers in 5 minutes!
  24. 24. [email_address]