November 7, 2014 Philippe Alexis

Optimal Way to Host WordPress

Mark Jaquith  Next Generation WordPress Hosting Stack   WordPress.tvThis post is based on Mark Jaquith‘s 16 October 2014 talk Next Generation WordPress Hosting Stack.

WordPress is dynamic and so every time a page is rendered it is created on the fly. Systems like Movable Type used to prerender all their pages but with large (more than 1,000 pages) WP site this is impractical.

Speed Considerations

You can measure speed of download using the Network Tab in Inspect Element of Chrome.

 3 seconds + : Performance Emergency, you will lose users

1-3 seconds : Users will be annoyed but most will stick with this suboptimal experience

.5-1 second: May seem a little bit slow but not noticeable

250-500 ms: Good, users engaged

<250 ms: FAST

<100 ms: INSTANT

Mark mentioned that he managed to get his site http://havebabyneedstuff.com/ display in 29 ms.

WordPress Hosting for Performance

You need to do it yourself using a VPS (Virtual Private Server); Mark recommends Linode and Digital Ocean.

  • PHP-FPM – use to run PHP on Nginx: http://php-fpm.org/
  • Latest version of PHP (5.5 at the time of writing), much faster than previous versions, has a built-in opcode cache.
  • HHVM (HipHop Virtual Machine) Alternative to PHP-FPM, project by Facebook. Amazing performance benefits and fully supports WP. Set up site monitoring because still a bit unstable, but can be 4-5 times faster than PHP-FPM
  • MySQL
  • Caching – Nginx is Mark’s preferred way to cache, see his set up here. HTML output caching is crude, object caching is elegant. WP supports this in core, by default it uses object caching. Mark recommends using redis for caching (Pantheon is the only WP hoster currently using this).Also use the PHP caching functions such as wp_cache_set() to cache. The rule of thumb is to cache any data that’s expensive to build or that talks to remote servers.Here’s Mark library that wraps the WP Transients API (option for soft expiration).
  • Measuring – Mark uses New Relic for analyzing why a site/query is slow.

Recommended WordPress Stack

Nginx (with caching)
PHP (HHVM)

MySQL
Redis

About the Author

Philippe Alexis “In 1997 I was working in the City of London in an investment bank, dealing with financial derivatives, when one day the IT staff set up a fast Internet connection on my computer. It changed my life. I spent the whole day surfing the early web, and from that day I realized that I wanted to be involved with it somehow in my professional life. It took 2 years to transition to working as a web developer. I started creating basic sites for charities (like Re-Cycle). After working for an Internet start up (bivio, improbably still alive today), I set up No Diamonds.”

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Let us know how we can help you: