WordPress Performance Guide : From 5 to 6100 requests/sec on a 1Vcpu/1GB Ram VPS

After teasing in my last post, here is the full tutorial on how to improve your WordPress performances.

This idea started last week. As a Solution Architect @Hegerys, I had to provide a new solution for Magento hosting on a unique dedicated server.
But as we all know, if Magento is a very good and competitive eCommerce Software, it is also one of the slower, if not the slowest and heavyest. Getting good performance for this kind of web application on a unique dedicated server just seemed impossible.

Then before delivering, I wanted to test out how I could improve performances on a web software without having to get my hands directly into the code.
I had this wordpress blog (the one you’re reading) on a non-optimized WordPress behing a non-optimized apache+mod_php, on a very little VPS (1VCore, 1GBram).

When I started this work, http://blog.brigato.fr was only handling 5 requests/sec. It now handles more than 6000 requests/sec.

By following this tutorial, you should be able to improve a fresh untouched Wordbress performances by a factor 1000, and an optimized (W3 Total Cache, APC Enabled…) WordPress by a factor 400.

The very Beginning

When things began, this was all I had :

  • A 1Vcore/1GBRam VPS
  • A slow and poor 20GB Virtual disk on a <80 I/Ops SATA Harddrive
  • A not-so-fresh Debian “Squeeze” 6 x86_64 OS
  • An untouched Apache2.2+mod_php5.3.6 with KeepAlive set a Off
  • An untouched MySQL 5.5
  • A non-optimized (no plugins) WordPress 3.3

Using Apache Benchmark tool, it resulted on a 5 requests/sec on the blog Index page.

ab -c 10 -n 100 http://blog.brigato.fr/

Also, the VPS was overloading and swaping immediately. The VPS needed a hard-reboot just after this very little benchmark.

I decided to go on with optimizations on 3 big points :

  • WordPress Internal performances :
    • Page static caching
    • PHP’s Opcode caching
  • Routing/Static content delivery performances :
    • Stop the delivery of static content through Apache
    • Reserve Apache only for code execution
    • Frontend all request to a fast static delivering solution along with content-routing capacities
  • Fast Caching frontend :
    • Should RAM-cache every possible elements
    • Should provide Connection Reuse Model to benefits from KeepAlive and unload both Routing and Apache frontend

3 thoughts on “WordPress Performance Guide : From 5 to 6100 requests/sec on a 1Vcpu/1GB Ram VPS

  1. I’m using Varnish too now, and I like the 1000-2000 hits/s that it can easily provide on my low-end VPS. I do find you need quite a lot of RAM for it to work well, though!

  2. Pingback: WordPress Optimization Tips - Gabfire Premium WordPress Themes

  3. Hi, nice work! Thanx.
    But are you shure to set “proxy_set_header X-Forwarded-For $remote_addr;” in nginx config? What’s the value of $remote_addr?
    Isn’t it the adress of the varnish-cache in front?

    I have the problem that my piwik-service isn’t tracking the user-ip with the setup you described.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>