SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
From One to a Cluster
 Brian Moon, Senior Developer - dealnews.com
       2008 MySQL Conference & Expo
        http://dealnews.com/developers/
The Early Years
• 1997 - 1999 Shared Account
   • Hand edited HTML
   • Perl, PHP, msql
• 1999 - 2000 Dedicated Servers
   • Developed custom CMS
   • Dynamic content with PHP and MySQL
The first cluster

• 3-5 Web servers
• 1 NFS server
• 1 MySQL server
• 1 mail server
Bottlenecks
• Software load balancing
 • Wave effect
 • Closed, required specific OS version
• NFS did not scale
 • Disk Cache
 • Code on NFS
Solutions
• Hardware load balancing
 • Arrowpoint/Cisco (from eBay)
 • F5 BIG-IP (not cheap)
• Drop NFS
 • Memcached - distributed memory cache
 • Use rsync to push changes to production
Status in 2006
• 5 web nodes w/ hardware lb
• Using rsync to put code on
  servers
• 1 MySQL server
• memcached to cache data
  from database
• All pages built “on the fly”
  from cache (hopefully)
Yahoo! Effect
                                                    2nd Yahoo!

         Digg
Radio Tour      “Cyber Monday”   Yahoo Front Page
First Yahoo!
Yahoo! Effect
                                                    2nd Yahoo!

         Digg
Radio Tour      “Cyber Monday”   Yahoo Front Page
Second Yahoo!
New Bottlenecks

• Cache stampede
 • 1000 requests for the same thing
• Bandwidth
 • Image bandwidth alone hit 60Mb/s
• Hundreds of lines of code =(
Solutions
• Offload CSS, Javascript and images
  bandwidth to CDN
• Cache content in memory at the forward
  facing servers
• Use a “Pushed Cache”
• Refactor all the code
Using a CDN
Pros
• Offloads bandwidth
• Many locations, hopefully near your users
• Bandwidth is cheaper than you can buy it
Cons
• Out of your control
• More complicated to invalidate objects
Caching Proxy
• Custom PHP script
 • Researched Squid and wrote Perl and
    Python versions too.
• Uses memcached for cache storage
 • One copy of an item in cache, not several
• Apache 2 worker MPM (Yes, it does work!)
 • Tried lighttpd with FastCGI as well
Pushed Cache
• User requests can never cause database load
 • No cache stampede
• Data can be prepared when we are ready
 • De-normalized to be ready for the site
• Data can come straight from MySQL
• Scales out with MySQL Replication
Straight from the DB?

• Use EXPLAIN a lot
• Avoid filesort and temporary
• Avoid complex joins (or any)
• Use InnoDB (row locking / transactions)
• Write a library/object for code to use
Current Architecture Overview


                 Internet
                             Main DB




Proxy    App    Replicated   Process
                   DB
Load balancing
We cheat a lot with F5 BIG-IP
• Balances incoming traffic
• Balances internal services
• Not cheap, but worth it for us
Linux Virtual Server
•   Open source
•   Up/Down monitoring is not built in
From One to a Cluster
               Not MySQL Cluster, sorry =(

 Brian Moon, Senior Developer - dealnews.com
       2008 MySQL Conference & Expo
        http://dealnews.com/developers/

Contenu connexe

Tendances

Distributed computing in browsers as client side attack
Distributed computing in browsers as client side attackDistributed computing in browsers as client side attack
Distributed computing in browsers as client side attack
Ivan Novikov
 
MongoDB backup service overview Boston MUG
MongoDB backup service overview Boston MUGMongoDB backup service overview Boston MUG
MongoDB backup service overview Boston MUG
MongoDB
 
Алексей Петров "PHP at Scale: Knowing enough to be dangerous!"
Алексей Петров "PHP at Scale: Knowing enough to be dangerous!"Алексей Петров "PHP at Scale: Knowing enough to be dangerous!"
Алексей Петров "PHP at Scale: Knowing enough to be dangerous!"
Fwdays
 

Tendances (17)

Velocity 2010 - ATS
Velocity 2010 - ATSVelocity 2010 - ATS
Velocity 2010 - ATS
 
Rails hosting
Rails hostingRails hosting
Rails hosting
 
Massively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPMassively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHP
 
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
 
Design a scalable site: Problem and solutions
Design a scalable site: Problem and solutionsDesign a scalable site: Problem and solutions
Design a scalable site: Problem and solutions
 
Erlang vs Ruby SOA Scheduling
Erlang vs Ruby SOA SchedulingErlang vs Ruby SOA Scheduling
Erlang vs Ruby SOA Scheduling
 
Distributed computing in browsers as client side attack
Distributed computing in browsers as client side attackDistributed computing in browsers as client side attack
Distributed computing in browsers as client side attack
 
MongoDB backup service overview Boston MUG
MongoDB backup service overview Boston MUGMongoDB backup service overview Boston MUG
MongoDB backup service overview Boston MUG
 
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!
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
 
04 web optimization
04 web optimization04 web optimization
04 web optimization
 
Ruby eventmachine pres at rubybdx
Ruby eventmachine pres at rubybdxRuby eventmachine pres at rubybdx
Ruby eventmachine pres at rubybdx
 
RabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeRabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = Awesome
 
Caching Data For Performance
Caching Data For PerformanceCaching Data For Performance
Caching Data For Performance
 
Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
 
Cache hcm-topdev
Cache hcm-topdevCache hcm-topdev
Cache hcm-topdev
 
Алексей Петров "PHP at Scale: Knowing enough to be dangerous!"
Алексей Петров "PHP at Scale: Knowing enough to be dangerous!"Алексей Петров "PHP at Scale: Knowing enough to be dangerous!"
Алексей Петров "PHP at Scale: Knowing enough to be dangerous!"
 

En vedette (6)

Lifelong Learning and Museums
Lifelong Learning and MuseumsLifelong Learning and Museums
Lifelong Learning and Museums
 
PresentacióN1
PresentacióN1PresentacióN1
PresentacióN1
 
Palabras
PalabrasPalabras
Palabras
 
Security @ work
Security @ workSecurity @ work
Security @ work
 
OWASP PHPIDS talk slides
OWASP PHPIDS talk slidesOWASP PHPIDS talk slides
OWASP PHPIDS talk slides
 
CONVIVENCIA
CONVIVENCIACONVIVENCIA
CONVIVENCIA
 

Similaire à From One to a Cluster

Scaling a Web Service
Scaling a Web ServiceScaling a Web Service
Scaling a Web Service
Leon Ho
 
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
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deployment
Abhishek Singh
 

Similaire à From One to a Cluster (20)

Scaling a Web Service
Scaling a Web ServiceScaling a Web Service
Scaling a Web Service
 
Advanced Deployment
Advanced DeploymentAdvanced Deployment
Advanced Deployment
 
Cache hcm-topdev
Cache hcm-topdevCache hcm-topdev
Cache hcm-topdev
 
Qcon
QconQcon
Qcon
 
MySQL Aquarium Paris
MySQL Aquarium ParisMySQL Aquarium Paris
MySQL Aquarium Paris
 
re7jweiss
re7jweissre7jweiss
re7jweiss
 
Extending The My Sql Data Landscape
Extending The My Sql Data LandscapeExtending The My Sql Data Landscape
Extending The My Sql Data Landscape
 
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)
 
20080611accel
20080611accel20080611accel
20080611accel
 
Scaling the Rails
Scaling the RailsScaling the Rails
Scaling the Rails
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deployment
 
20080528dublinpt1
20080528dublinpt120080528dublinpt1
20080528dublinpt1
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring Rails
 
Scaling Drupal: Not IF... HOW
Scaling Drupal: Not IF... HOWScaling Drupal: Not IF... HOW
Scaling Drupal: Not IF... HOW
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference Recap
 
Development to Production with Sharded MongoDB Clusters
Development to Production with Sharded MongoDB ClustersDevelopment to Production with Sharded MongoDB Clusters
Development to Production with Sharded MongoDB Clusters
 
EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...
EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...
EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...
 
Xen Virtualization 2008
Xen Virtualization 2008Xen Virtualization 2008
Xen Virtualization 2008
 
Deployment with Ruby on Rails
Deployment with Ruby on RailsDeployment with Ruby on Rails
Deployment with Ruby on Rails
 
A Tale of 2 Systems
A Tale of 2 SystemsA Tale of 2 Systems
A Tale of 2 Systems
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

From One to a Cluster

  • 1. From One to a Cluster Brian Moon, Senior Developer - dealnews.com 2008 MySQL Conference & Expo http://dealnews.com/developers/
  • 2. The Early Years • 1997 - 1999 Shared Account • Hand edited HTML • Perl, PHP, msql • 1999 - 2000 Dedicated Servers • Developed custom CMS • Dynamic content with PHP and MySQL
  • 3. The first cluster • 3-5 Web servers • 1 NFS server • 1 MySQL server • 1 mail server
  • 4. Bottlenecks • Software load balancing • Wave effect • Closed, required specific OS version • NFS did not scale • Disk Cache • Code on NFS
  • 5. Solutions • Hardware load balancing • Arrowpoint/Cisco (from eBay) • F5 BIG-IP (not cheap) • Drop NFS • Memcached - distributed memory cache • Use rsync to push changes to production
  • 6. Status in 2006 • 5 web nodes w/ hardware lb • Using rsync to put code on servers • 1 MySQL server • memcached to cache data from database • All pages built “on the fly” from cache (hopefully)
  • 7. Yahoo! Effect 2nd Yahoo! Digg Radio Tour “Cyber Monday” Yahoo Front Page
  • 9. Yahoo! Effect 2nd Yahoo! Digg Radio Tour “Cyber Monday” Yahoo Front Page
  • 11. New Bottlenecks • Cache stampede • 1000 requests for the same thing • Bandwidth • Image bandwidth alone hit 60Mb/s • Hundreds of lines of code =(
  • 12. Solutions • Offload CSS, Javascript and images bandwidth to CDN • Cache content in memory at the forward facing servers • Use a “Pushed Cache” • Refactor all the code
  • 13. Using a CDN Pros • Offloads bandwidth • Many locations, hopefully near your users • Bandwidth is cheaper than you can buy it Cons • Out of your control • More complicated to invalidate objects
  • 14. Caching Proxy • Custom PHP script • Researched Squid and wrote Perl and Python versions too. • Uses memcached for cache storage • One copy of an item in cache, not several • Apache 2 worker MPM (Yes, it does work!) • Tried lighttpd with FastCGI as well
  • 15. Pushed Cache • User requests can never cause database load • No cache stampede • Data can be prepared when we are ready • De-normalized to be ready for the site • Data can come straight from MySQL • Scales out with MySQL Replication
  • 16. Straight from the DB? • Use EXPLAIN a lot • Avoid filesort and temporary • Avoid complex joins (or any) • Use InnoDB (row locking / transactions) • Write a library/object for code to use
  • 17. Current Architecture Overview Internet Main DB Proxy App Replicated Process DB
  • 18. Load balancing We cheat a lot with F5 BIG-IP • Balances incoming traffic • Balances internal services • Not cheap, but worth it for us Linux Virtual Server • Open source • Up/Down monitoring is not built in
  • 19. From One to a Cluster Not MySQL Cluster, sorry =( Brian Moon, Senior Developer - dealnews.com 2008 MySQL Conference & Expo http://dealnews.com/developers/