roshan bhattarai: scaling wordpress for high traffic sites
TRANSCRIPT
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?