SlideShare une entreprise Scribd logo
1  sur  24
Scaling for Higher Payload
Top4top.ru 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.
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.
Normal Day
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.
Normal Day // Cache
Normal Day // Cache Administrators should be able to edit posts in this block. Thus, no caching for administrators here.
Normal Day // Cache
Let’s Test It! Normal day, 1 server in Ireland, the client is 10 hops away on a 10 Mbit channel
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.
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.
Normal Day // Homepage Traffic
Normal Day // nginx config
Normal Day // nginx config
Normal Day // nginx config
Rainy Day
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!
Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger apache + passenger
Rainy Day // Infrastructure If it’s not enough, the main server begins to serve as base only, shutting down its own apache.
Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger
Rainy Day // Infrastructure The final step is to isolate MySQL. Now we’re able to serve millions of pageviews for $350 per month.
Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger MySQL
Rainy Day // Cloning top4top top4top-1 top4top-2 top4top-3 3 additional servers in 5 minutes!
[email_address]

Contenu connexe

Tendances

Frontend Track NodeJS
Frontend Track NodeJSFrontend Track NodeJS
Frontend Track NodeJSMarcelo Serpa
 
Happy Browser, Happy User! WordSesh 2019
Happy Browser, Happy User! WordSesh 2019Happy Browser, Happy User! WordSesh 2019
Happy Browser, Happy User! WordSesh 2019Katie Sylor-Miller
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs Irfan Maulana
 
Introduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsIntroduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsPerrin Harkins
 
Native Clients, more the merrier with GFProxy!
Native Clients, more the merrier with GFProxy!Native Clients, more the merrier with GFProxy!
Native Clients, more the merrier with GFProxy!Gluster.org
 
Reducing latency on the web with the Azure CDN - DevSum - SWAG
Reducing latency on the web with the Azure CDN - DevSum - SWAGReducing latency on the web with the Azure CDN - DevSum - SWAG
Reducing latency on the web with the Azure CDN - DevSum - SWAGMaarten Balliauw
 
Erlang vs Ruby SOA Scheduling
Erlang vs Ruby SOA SchedulingErlang vs Ruby SOA Scheduling
Erlang vs Ruby SOA Schedulingmarfeyh
 
Reducing latency on the web with the Azure CDN- TechDays NL 2014
Reducing latency on the web with the Azure CDN- TechDays NL 2014Reducing latency on the web with the Azure CDN- TechDays NL 2014
Reducing latency on the web with the Azure CDN- TechDays NL 2014Maarten Balliauw
 
Event Driven Architecture Concepts in Web Technologies - Part 1
Event Driven Architecture Concepts in Web Technologies - Part 1Event Driven Architecture Concepts in Web Technologies - Part 1
Event Driven Architecture Concepts in Web Technologies - Part 1Hamidreza Soleimani
 
Growing MongoDB on AWS
Growing MongoDB on AWSGrowing MongoDB on AWS
Growing MongoDB on AWScolinthehowe
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineNGINX, Inc.
 
Windows Azure Service Bus
Windows Azure Service BusWindows Azure Service Bus
Windows Azure Service BusPavel Revenkov
 
Speeding up Page Load Times by Using Starling
Speeding up Page Load Times by Using StarlingSpeeding up Page Load Times by Using Starling
Speeding up Page Load Times by Using StarlingErik Osterman
 
Level Up: 5 Expert Tips for Optimizing WordPress Performance
Level Up: 5 Expert Tips for Optimizing WordPress PerformanceLevel Up: 5 Expert Tips for Optimizing WordPress Performance
Level Up: 5 Expert Tips for Optimizing WordPress PerformancePantheon
 
Welcome to ClojureScript
Welcome to ClojureScriptWelcome to ClojureScript
Welcome to ClojureScriptIkuru Kanuma
 

Tendances (18)

Node intro
Node introNode intro
Node intro
 
Frontend Track NodeJS
Frontend Track NodeJSFrontend Track NodeJS
Frontend Track NodeJS
 
Happy Browser, Happy User! WordSesh 2019
Happy Browser, Happy User! WordSesh 2019Happy Browser, Happy User! WordSesh 2019
Happy Browser, Happy User! WordSesh 2019
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs
 
Introduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsIntroduction to performance tuning perl web applications
Introduction to performance tuning perl web applications
 
Native Clients, more the merrier with GFProxy!
Native Clients, more the merrier with GFProxy!Native Clients, more the merrier with GFProxy!
Native Clients, more the merrier with GFProxy!
 
Reducing latency on the web with the Azure CDN - DevSum - SWAG
Reducing latency on the web with the Azure CDN - DevSum - SWAGReducing latency on the web with the Azure CDN - DevSum - SWAG
Reducing latency on the web with the Azure CDN - DevSum - SWAG
 
Erlang vs Ruby SOA Scheduling
Erlang vs Ruby SOA SchedulingErlang vs Ruby SOA Scheduling
Erlang vs Ruby SOA Scheduling
 
Reducing latency on the web with the Azure CDN- TechDays NL 2014
Reducing latency on the web with the Azure CDN- TechDays NL 2014Reducing latency on the web with the Azure CDN- TechDays NL 2014
Reducing latency on the web with the Azure CDN- TechDays NL 2014
 
Event Driven Architecture Concepts in Web Technologies - Part 1
Event Driven Architecture Concepts in Web Technologies - Part 1Event Driven Architecture Concepts in Web Technologies - Part 1
Event Driven Architecture Concepts in Web Technologies - Part 1
 
Growing MongoDB on AWS
Growing MongoDB on AWSGrowing MongoDB on AWS
Growing MongoDB on AWS
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
 
Windows Azure Service Bus
Windows Azure Service BusWindows Azure Service Bus
Windows Azure Service Bus
 
Performance Web
Performance WebPerformance Web
Performance Web
 
Speeding up Page Load Times by Using Starling
Speeding up Page Load Times by Using StarlingSpeeding up Page Load Times by Using Starling
Speeding up Page Load Times by Using Starling
 
Level Up: 5 Expert Tips for Optimizing WordPress Performance
Level Up: 5 Expert Tips for Optimizing WordPress PerformanceLevel Up: 5 Expert Tips for Optimizing WordPress Performance
Level Up: 5 Expert Tips for Optimizing WordPress Performance
 
Welcome to ClojureScript
Welcome to ClojureScriptWelcome to ClojureScript
Welcome to ClojureScript
 
Getting started with node.js
Getting started with node.jsGetting started with node.js
Getting started with node.js
 

Similaire à Scaling for Higher Payload with Nginx, Apache, Passenger and MySQL

Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)WordCamp Cape Town
 
Configuring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceConfiguring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceSpark::red
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimizationAlmog Baku
 
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)grantnorwood
 
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)Grant Norwood
 
Lamp Stack Optimization
Lamp Stack OptimizationLamp Stack Optimization
Lamp Stack OptimizationDave Ross
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on SteroidsSiteGround.com
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Cloud computing & lamp applications
Cloud computing & lamp applicationsCloud computing & lamp applications
Cloud computing & lamp applicationsCorley S.r.l.
 
How Varnish & MongoDB Scale Business Insider
How Varnish & MongoDB Scale Business InsiderHow Varnish & MongoDB Scale Business Insider
How Varnish & MongoDB Scale Business InsiderPax Dickinson
 
How Netflix Tunes Amazon EC2 Instances for Performance - CMP325 - re:Invent 2017
How Netflix Tunes Amazon EC2 Instances for Performance - CMP325 - re:Invent 2017How Netflix Tunes Amazon EC2 Instances for Performance - CMP325 - re:Invent 2017
How Netflix Tunes Amazon EC2 Instances for Performance - CMP325 - re:Invent 2017Amazon Web Services
 
Improving PHP Application Performance with APC
Improving PHP Application Performance with APCImproving PHP Application Performance with APC
Improving PHP Application Performance with APCvortexau
 
Django book15 caching
Django book15 cachingDjango book15 caching
Django book15 cachingShih-yi Wei
 
Startups to Scale
Startups to ScaleStartups to Scale
Startups to Scaleguest73ced5
 

Similaire à Scaling for Higher Payload with Nginx, Apache, Passenger and MySQL (20)

Kafka vs kinesis
Kafka vs kinesisKafka vs kinesis
Kafka vs kinesis
 
Nginx
NginxNginx
Nginx
 
Nginx dhruba mandal
Nginx dhruba mandalNginx dhruba mandal
Nginx dhruba mandal
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 
A faster web
A faster webA faster web
A faster web
 
Configuring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceConfiguring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web Perormance
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimization
 
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
 
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
Cluster Fudge: Recipes for WordPress in the Cloud (WordCamp Austin 2014 Speaker)
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
Lamp Stack Optimization
Lamp Stack OptimizationLamp Stack Optimization
Lamp Stack Optimization
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Cloud computing & lamp applications
Cloud computing & lamp applicationsCloud computing & lamp applications
Cloud computing & lamp applications
 
How Varnish & MongoDB Scale Business Insider
How Varnish & MongoDB Scale Business InsiderHow Varnish & MongoDB Scale Business Insider
How Varnish & MongoDB Scale Business Insider
 
How Netflix Tunes Amazon EC2 Instances for Performance - CMP325 - re:Invent 2017
How Netflix Tunes Amazon EC2 Instances for Performance - CMP325 - re:Invent 2017How Netflix Tunes Amazon EC2 Instances for Performance - CMP325 - re:Invent 2017
How Netflix Tunes Amazon EC2 Instances for Performance - CMP325 - re:Invent 2017
 
Improving PHP Application Performance with APC
Improving PHP Application Performance with APCImproving PHP Application Performance with APC
Improving PHP Application Performance with APC
 
Django book15 caching
Django book15 cachingDjango book15 caching
Django book15 caching
 
Startups to Scale
Startups to ScaleStartups to Scale
Startups to Scale
 

Scaling for Higher Payload with Nginx, Apache, Passenger and MySQL

  • 2. Top4top.ru 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. 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.
  • 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.
  • 7. Normal Day // Cache Administrators should be able to edit posts in this block. Thus, no caching for administrators here.
  • 9. Let’s Test It! Normal day, 1 server in Ireland, the client is 10 hops away on a 10 Mbit channel
  • 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. 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. Normal Day // Homepage Traffic
  • 13. Normal Day // nginx config
  • 14. Normal Day // nginx config
  • 15. Normal Day // nginx config
  • 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. Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger apache + passenger
  • 19. Rainy Day // Infrastructure If it’s not enough, the main server begins to serve as base only, shutting down its own apache.
  • 20. Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger
  • 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. Rainy Day // Infrastructure nginx apache + passenger apache + passenger apache + passenger MySQL
  • 23. Rainy Day // Cloning top4top top4top-1 top4top-2 top4top-3 3 additional servers in 5 minutes!