A Crash Course in
Scaling WordPress
A Crash Course in
Scaling WordPress
or: let me at least
show you what is possible
(in 8 minutes)
A Crash Course in
Scaling WordPress
or: let me at least
show you what is possible
(in 8 minutes)
A Crash Course in
Scaling WordPress
or: let me at least
show you what is possible
(in 8 minutes)
[and then I'll take questions]
• Andrew Nacin
• Lead Developer for WordPress
• Washington, D.C.
• Work for WP founder Matt Mullenweg
(Don't work for Automattic or WP.com)
• Full time on WordPress (the project)
and WordPress.org (the site)
WordPress can scale
(no, really!)
WordPress can scale
(and it's easy!)
nginx
nginx
nginx
nginx
nginx
nginx
(with PHP-FPM)
• nginx is a web server (like Apache or IIS)
• nginx is better
• nginx is so much better it isn't even funny
• Well-tuned Apache can serve a few hundred
requests a second
• nginx can serve 10,000 requests/sec and up
nginx can be a…
• request router/load balancer (layer 7)
• load balancer(layer 4)
• front end proxy (often proxying to Apache)
• web server (using PHP-FPM)
• cache (fastcgi_cache and proxy_cache)
nginx can be a…
• request router/load balancer (layer 7)
• load balancer(layer 4)
• front end proxy (often proxying to Apache)
• web server (using PHP-FPM)
• cache (fastcgi_cache and proxy_cache)
and it is all of these things for WP.com and WP.org
If you can't switch out Apache
(because reasons)
Try to still still use nginx
as a front-end proxy
and caching layer
At the PHP level:
Use the latest version of PHP
for security and performance
Turn on PHP opcode cache,
also called a PHP accelerator
• APC (until PHP 5.5)
• Zend Optimizer+ (PHP 5.5 and up)
Inside WordPress (Objects)
Enable object caching in WordPress
• stores objects in a key-value store like
APC, Memcached, Redis, and WinCache
– APC for one server, Memcached for multiple
• avoids database queries
• improves speed and performance
• lowers memory consumption
Inside WordPress (DB)
Have multiple database servers?
Use HyperDB by Automattic.
• splitting reads/writes
• master/slave setups
• DB failover
• sharding
• multiple databases
• multiple datacenters (mind blown)
Inside WordPress (Debugging)
• Use the Debug Bar plugin
by the WordPress core team
• It's like Firebug or the Web Inspector,
but for WordPress
• Inspect queries, cache hits, performance
• Watch for errors and deprecated notices
• General debugging
• Look for issues with themes and plugins
Inside WordPress (Page Caching)
• Temporarily Caching entire pages and
serving those pages as fast as possible
– nginx can do most of this for you
• Batcache by Automattic
(You may have also heard of
W3 Total Cache & WP Super Cache)
At the hardware level:
(Solid-State Drives)
SSDs
one server, 10,000 requests/sec
864,000,000
requests a day
• nacin@wordpress.org
• Questions?

A crash course in scaling wordpress

  • 1.
    A Crash Coursein Scaling WordPress
  • 2.
    A Crash Coursein Scaling WordPress or: let me at least show you what is possible (in 8 minutes)
  • 3.
    A Crash Coursein Scaling WordPress or: let me at least show you what is possible (in 8 minutes)
  • 4.
    A Crash Coursein Scaling WordPress or: let me at least show you what is possible (in 8 minutes) [and then I'll take questions]
  • 5.
    • Andrew Nacin •Lead Developer for WordPress • Washington, D.C. • Work for WP founder Matt Mullenweg (Don't work for Automattic or WP.com) • Full time on WordPress (the project) and WordPress.org (the site)
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
    • nginx isa web server (like Apache or IIS) • nginx is better • nginx is so much better it isn't even funny • Well-tuned Apache can serve a few hundred requests a second • nginx can serve 10,000 requests/sec and up
  • 15.
    nginx can bea… • request router/load balancer (layer 7) • load balancer(layer 4) • front end proxy (often proxying to Apache) • web server (using PHP-FPM) • cache (fastcgi_cache and proxy_cache)
  • 16.
    nginx can bea… • request router/load balancer (layer 7) • load balancer(layer 4) • front end proxy (often proxying to Apache) • web server (using PHP-FPM) • cache (fastcgi_cache and proxy_cache) and it is all of these things for WP.com and WP.org
  • 17.
    If you can'tswitch out Apache (because reasons) Try to still still use nginx as a front-end proxy and caching layer
  • 18.
    At the PHPlevel: Use the latest version of PHP for security and performance Turn on PHP opcode cache, also called a PHP accelerator • APC (until PHP 5.5) • Zend Optimizer+ (PHP 5.5 and up)
  • 19.
    Inside WordPress (Objects) Enableobject caching in WordPress • stores objects in a key-value store like APC, Memcached, Redis, and WinCache – APC for one server, Memcached for multiple • avoids database queries • improves speed and performance • lowers memory consumption
  • 20.
    Inside WordPress (DB) Havemultiple database servers? Use HyperDB by Automattic. • splitting reads/writes • master/slave setups • DB failover • sharding • multiple databases • multiple datacenters (mind blown)
  • 21.
    Inside WordPress (Debugging) •Use the Debug Bar plugin by the WordPress core team • It's like Firebug or the Web Inspector, but for WordPress • Inspect queries, cache hits, performance • Watch for errors and deprecated notices • General debugging • Look for issues with themes and plugins
  • 22.
    Inside WordPress (PageCaching) • Temporarily Caching entire pages and serving those pages as fast as possible – nginx can do most of this for you • Batcache by Automattic (You may have also heard of W3 Total Cache & WP Super Cache)
  • 23.
    At the hardwarelevel: (Solid-State Drives) SSDs
  • 24.
    one server, 10,000requests/sec 864,000,000 requests a day
  • 25.