Scaling WordPress for High
         Traffic
Roshan Bhattarai
•   Father
•   Author - (Co-author : PHP Ajax Cookbook )
•   Software Developer
•    And so called CTO @ proshore
Optimization Tips for Shared hosting
• Use W3 Total Cache plugin for caching page and
  datas .
• Serve all the static contents(JavaScript , CSS files
  and Images ) from Content Delivery Network.
• Use jQuery lazy load plugin to server images if
  there are many.
• Minify and Gzip the CSS and and JavaScript files.
• For big number of posts and comment table use
  MySQL’s logical partition.
  http://pento.net/2011/04/28/partitioning-the-
  wordpress-comments-table/
W3 Total Cache
Main Features :
• Page Caching
• Minify
• Database Caching
• Headers: W3TC manages the HTTP headers
  (cache-control, expires)
• Content Delivery Network (CDN )
Content Delivery Network

• Serving static content directly from own server
• Uploading static files to server and serving
  from there
Still problem
           ………………..

Time to move to VPS or Dedicated
           Server 
Recommended Server Configuration
• Use Nginx Web Server than Apache
• Use Varnish or Squid (Reverse Proxy Servers )for
  serving static content over Nginx server
• Use PHP-FMP (FastCGI Process Manager)
• Implement Sphinx search engine or Lucene
  Search Engine for full text search on database.
• As always use CDN 
• Use Opcode Cache Engine for W3 Total Cache (
  APC recommended)
That should be able to cope around 10
     million hits a day on normal
          Wordpress website.

http://www.ewanleith.com/blog/900/
10-million-hits-a-day-with-wordpress-
          using-a-15-server
Still high CPU and memory ususage on
                server 

Time to use multiple HTTP servers and
      multiple database servers.
Using Load balancer
Load Balancing Technique
• Round Robin DNS
• Software Load balancer ( recommended
  HaProxy)
• Hardware load Balancing ( Cisco , Citrix etc )

Note : Use NFS to store static files and data on
 database.
Database Replication
Database Sharding




Software used for sharding MySQL : HiveDB
For WordPress use HyperDB 
•   Ability to use multiple databases.
•   Supports partition of data.
•   Supports replication.
•   Supports failover.
Thank you for listening 

     Any questions?

Roshan Bhattarai: Scaling WordPress for high traffic sites

  • 1.
  • 2.
    Roshan Bhattarai • Father • Author - (Co-author : PHP Ajax Cookbook ) • Software Developer • And so called CTO @ proshore
  • 3.
    Optimization Tips forShared hosting • Use W3 Total Cache plugin for caching page and datas . • Serve all the static contents(JavaScript , CSS files and Images ) from Content Delivery Network. • Use jQuery lazy load plugin to server images if there are many. • Minify and Gzip the CSS and and JavaScript files. • For big number of posts and comment table use MySQL’s logical partition. http://pento.net/2011/04/28/partitioning-the- wordpress-comments-table/
  • 4.
    W3 Total Cache MainFeatures : • Page Caching • Minify • Database Caching • Headers: W3TC manages the HTTP headers (cache-control, expires) • Content Delivery Network (CDN )
  • 5.
    Content Delivery Network •Serving static content directly from own server • Uploading static files to server and serving from there
  • 6.
    Still problem ……………….. Time to move to VPS or Dedicated Server 
  • 7.
    Recommended Server Configuration •Use Nginx Web Server than Apache • Use Varnish or Squid (Reverse Proxy Servers )for serving static content over Nginx server • Use PHP-FMP (FastCGI Process Manager) • Implement Sphinx search engine or Lucene Search Engine for full text search on database. • As always use CDN  • Use Opcode Cache Engine for W3 Total Cache ( APC recommended)
  • 8.
    That should beable to cope around 10 million hits a day on normal Wordpress website. http://www.ewanleith.com/blog/900/ 10-million-hits-a-day-with-wordpress- using-a-15-server
  • 9.
    Still high CPUand memory ususage on server  Time to use multiple HTTP servers and multiple database servers.
  • 10.
  • 11.
    Load Balancing Technique •Round Robin DNS • Software Load balancer ( recommended HaProxy) • Hardware load Balancing ( Cisco , Citrix etc ) Note : Use NFS to store static files and data on database.
  • 12.
  • 13.
    Database Sharding Software usedfor sharding MySQL : HiveDB
  • 14.
    For WordPress useHyperDB  • Ability to use multiple databases. • Supports partition of data. • Supports replication. • Supports failover.
  • 15.
    Thank you forlistening  Any questions?