Get started with high performance WordPress powered by Nginx

WordPress started life as a simple blogging tool back in 2003, with a handful of users who began to gradually switch to WordPress from other contemporary blogging tools – preferring WordPress’s flexibility. Now, WordPress is one of the most popular web content management systems on the Internet, supporting millions of websites and apparently being used for 22% of all new websites.

All the flexibility & extensibility comes at a price however. WordPress site performance can often be somewhat lacklustre; especially if your site makes heavy use of plugins or the plugins you do use are badly written.

Something else that often doesn’t help is the use of inexpensive shared web hosting to run your site as hosting is one arena where the old maxim of “you get what you pay for” always ring true.
Although there are many excellent web hosting services out there, some of the largest & cheapest hosts achieve their pricing through cramming as many websites as they can onto a handful of web server machines.
This tends to result in each site only being able to use a tiny fraction of the underlying server’s resources, which in the case of WordPress is one of the quickest ways to result in a slow site.

While you can’t do much about the underlying technology if your using a shared hosting service, there are many things you can do to help speed WordPress up; most of which I’m not going to cover here as there are many excellent resources available on the web that can help guide you in the right direction.

The basic principals to consider however are to use a decent caching plugin for WordPress (WP Total Cache for example), remove any unnecessary plugins, minify your CSS & JS, and try using a content delivery network or service such as CloudFlare.

If you’re still not happy with your site after this, then you probably need to change hosts…. Look for one who uses the LiteSpeed or Nginx webservers in place of Apache as this can help demonstrate that the host has an interest in how sites they host perform!

If you’ve outgrown shared hosting and run your own web server somewhere either as a physical machine or a virtual private machine (VPS), something to seriously consider is replacing Apache with Nginx – an “alternative” web server which can offer significent performance improvement over Apache while using your server’s resources more efficiently.

Fully compatible with PHP, it can be a little tricky to get running initially without a guide (I’m going to be publishing one soon covering my experience of getting Nginx running with PHP 5.3 via PHP-FPM & WordPress on CentOS 6), but is well worth trying out as it may go someway to helping you to get much more out out of your servers – along with much better performance when your site gets busy 🙂

For comparison purposes, one of our busy WordPress sites was starting to struggle when it reached 80-90 active users. We’d tuned Apache pretty well for the machine & load, but as traffic increased much beyond this point page load times reached 4-5 seconds regardless of the cached & tuned WordPress install. CPU load on the server was also much higher than we wanted, meaning that without adding more caching ahead of Apache (such as Varnish HTTP Accelerator for example, but thats another post) we weren’t going to get much more performance out of the machine.

After some successful trials, we migrated the site over to Nginx (no special tuning) and saw instant performance improvements. In load tests, the same machine now happily manages page load times of 1-2s with 1500+ while using greatly reduced CPU & memory; all suggesting that we could push much higher traffic volumes through the box without any issues.

The chart to the right shows a quick load test up to 500 concurrent users, demonstrating Nginx’s somewhat flat response under load which continued all the way up to 1500 users.

All our production WordPress sites now run on Nginx rather than Apache, and to say the least we’ve not looked back….!

Check back soon for a working guide to get you started with Nginx-powered WordPress.

In summary….

  • Run a WordPress website using shared hosting or your own web server?
  • Ever had performance problems when the site gets busy? Plagued with slow page load times?
  • Often hit high server load for a handful of users?
  • Heard of Nginx…..?

Similar Posts

Leave a Reply