Wordpress Performance Comparison: Using Nginx, Apache, APC and Varnish in Different Scenarios

Written by
Date: 2012-04-27 18:17:39 00:00


Introduction

If you follow this blog, you may already know that I'm somehow obsessed with performance. But performance with low resources.

I like to try to squeeze every drop of power from a server before upgrading it. Usually this is achievable tweaking configuration of the server.

This time, I've been playing with Wordpress and a Small VPS server. Here the specs:

  • 512 MB RAM
  • Shared CPU
  • Shared Disk
  • Arch Linux 32 Bits

It is the smallest Linode available by the time of this writing.

I've tested Wordpress on different possible configurations:

  • Apache, PHP, MySQL Standard
  • Apache, PHP, MySQL and APC
  • Nginx, PHP-FPM, MySQL
  • Nginx, PHP-FPM, MySQL and APC
  • Nginx, PHP-FPM, MySQL, APC and Varnish
  • Apache, PHP, MySQL, APC and Varnish

I've used the standard Wordpress installation, with no extra plugins installed, not even Total Cache or Super Cache. I think that if you have Varnish Cache running on the server, there is no need for another Cache. Varnish uses RAM so it is more efficient than any Wordpress plugin. RAM is small in this server, if you need more space you can configure Varnish to also use disk as cache and then you have less used files on disk, and most accessed files on RAM.

Full configurations facts can be found at: Increase Wordpress performance

The tests

I've used blitz.io to measure the performance of each configuration.

With Apache as well as with Nginx when APC was not installed, I used 1 to 40 concurrent sessions in one minute. Anything else put the VPS on its knees.

With the aid of APC, both Apache and Nginx could handle twice as load, so 1 to 80 concurrent sessions in one minute.

Finally Varnish made the site really fly, and supported 1 to 250 concurrent sessions in one minute, for a potential of 9 Million hits per day

The results

Apache + PHP, no APC or any other aid or cache.

Dotted line = Response times Line = Users

blitz.io result, wordpress on Apache

You can download the PDF of the report here

Nginx + PHP-FPM, no APC or any other aid or cache

blitz.io result, wordpress on Nginx

You can download the PDF of the report here

Apache + PHP + APC

blitz.io result, wordpress, apache, php with APC

You can download the PDF of the report here

Nginx + PHP-FPM + APC

blitz.io result, wordpress, Nginx, php-fpm and APC

You can download the PDF of the report here

Nginx + PHP-FPM + APC + Varnish

Finally when Varnish is installed it really makes a difference, and you can go from 3+ million visits per day to 9 million visits per day.

blitz.io result, wordpress, Nginx, php-fpm, APC and Varnish, 9 million visits per day

You can download the PDF report here

Edit: Because one reader asked, here are the results of:

Apache + PHP with APC and Varnish.

apache, php, apc, varnish, wordpress

You can download the PDF report here

Conclusion

As you can see, with a kind-of-well-configured server, you can use a standard copy of Wordpress with no Total Cache or Super Cache plugins, so keeping a very clean and standard Wordpress configuration.