Alain Fontaine’s Jabberbox

Stellar WordPress performance

by on Jan.18, 2009, under Blogs, Technology

In one of my earlier posts, I explained how I setup Squid to accelerate a remote photo serving appliance that is connected to the Internet over a slow 512Kbit/s ADSL line. I am now using the same setup to accelerate my WordPress blog. The results are quite stunning. Read on to find out more and see some performance results…

The setup

Here are the basics of my setup :

  • The hosting server is an OVH RPS virtual machine, probably one of the cheapest you can get in Europe. It has quite limited CPU, only 512MB of RAM, and 10GB of remote storage space that sits somewhere on a SAN that the machine connects to via iSCSI. It is running Debian Etch.
  • Apache version 2, PHP 5, and MySQL 5. I have installed APC in its default setup to accelerate PHP processing. Apache is liseting on port 8080 so that Squid can listen on port 80, setup as a transparent caching proxy.
  • I’m using WordPress version 2.7 with the WordPress Super Cache plugin installed.

Testing performance

To test the web serving performance, I use Apache Bench (ab) to send a bunch of requests to my blog. While this is still a pretty limited way of testing performance, it gives a good overview.

Here’s the command I use to test the performance without using Squid. I specify ab to connect to port 8080 which is the port Apache is listening to, as so :

ab -c 10 -n 500

This send 500 requests to the archive page, using 10 concurrent connections. The results are as follows:

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       53   73  12.1     72     113
Processing:   119  619 323.1    468    1876
Waiting:      119  616 323.3    466    1875
Total:        177  692 323.2    538    1970

Percentage of the requests served within a certain time (ms)
  50%    538
  66%    569
  75%    632
  80%    717
  90%   1281
  95%   1326
  98%   1440
  99%   1891
 100%   1970 (longest request)

What do these results tell?

  • “On average” (median), fully downloading that page takes 538 miliseconds.
  • 90% of the requests are done in 1281 ms or less.

These results are not so bad. Let’s see how it performs using the Squid now. The command I use is :

ab -c 10 -n 500

Note that I don’t specify the port number here, which means that it defaults to port 80, on which Squid is listening. Here are the results:

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       55  115 231.6     99    3089
Processing:   253  339  45.7    336     606
Waiting:       58  100  39.4     98     403
Total:        329  455 236.4    437    3439

Percentage of the requests served within a certain time (ms)
  50%    437
  66%    445
  75%    450
  80%    459
  90%    478
  95%    501
  98%    682
  99%    697
 100%   3439 (longest request)

What does it mean ?

  • The average is now down to 437 ms, a tad faster than before.
  • But more impressively, it now takes 478 ms or less for 90% of the visitors to download the full page. Compared to the 1281 ms of before, this is more than twice as fast (actually almost three times as fast). That is a huge improvement.

Added bonus – the machine’s load average using Apache directly, is up to 2.3 as the system has to fork Apache processes for the concurrent connections. Using Squid, the machine load is barely above 0 thanks to the optimized HTTP connection handling. Actually, Squid is serving all of these requests directly out of memory :

1232287344.903    223 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html
1232287344.909    222 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html
1232287344.935    216 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html
1232287344.951    212 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html
1232287344.956    201 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html
1232287344.965    202 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html
1232287344.972    191 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html
1232287345.000    212 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html
1232287345.008    208 x.x.x.x TCP_MEM_HIT/200 22460 GET - NONE/- text/html

Notice the TCP_MEM_HIT which shows that Squid serves the requested page directly out of RAM without even bothering Apache or the disk… and that also means that the Squid solution is much more scalable when traffic goes through the roof.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

:, , , ,
  • atshoom

    Mmm, smart use of a proxy.

  • Josh Straub

    Hell yeah, this is the kind of article I've been looking for, for a month! Actually I've been casually looking for a web-server benchmarking tool for a long time and I was slapping my forehead after reading this article, discovering that I already had the (in typical Unix style) cryptically named “ab.exe” on my system… I punched in your commands and found I could serve 1.4 req/sec by default on my WordPress test server, 59 req/sec with WP-Cache (Super “Half On”), and 256 req/sec with Super cache!

  • Wicker Bench Storage

    I'm not finished read this yet, but it's so fabulous 'n I'll back again when I was finished my job :D

  • web hosting company

    Thanks a lot for sharing your knowledge and this information with us here,.

  • reverse phone lookup

    This is, without doubt, one of the best, if not THE best, article I have read on this topic!  

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...