It took a little more wrangling than I expected, but I got the WP SuperCache plugin working. One thing that always irritated me about WordPress was that it insists on generating every page on the fly. This never made any sense to me, especially since the code is very database-intensive. The plugin works by generating static HTML pages and using mod_rewrite to avoid running any PHP at all for cache hits. Anyone who’s logged in or has commented bypasses the cache, so the real benefit is from ’strangers.’ Most importantly, if this site ever gets hammered with traffic, it will make much less of a difference than it would have beforehand. I’m hosting more blogs than I did in the past, so the odds of this happening are somewhat elevated.

Here are some stats… Here’s some info on the machine it runs on. N.B that my load average hovers around 0.01 most of the time. This is not a busy machine. All testing was done with the command ab2 -c10 -k -n1000 http://blogs.n1zyy.com/n1zyy/. (The -c10 tells it to issue 10 concurrent requests, and the -k tell is to use KeepAlive requests. The -n1000 tells it to run the test across 1,000 connection attempts.)

Here we are with no caching. N.B. that, instead of -n1000, I did -n50 (!). This is WP out of the box:

Concurrency Level:      10

Time taken for tests:   31.996882 seconds

Complete requests:      50

Failed requests:        0

Write errors:           0

Keep-Alive requests:    0

Total transferred:      2561500 bytes

HTML transferred:       2550000 bytes

Requests per second:    1.56 [#/sec] (mean)

Time per request:       6399.376 [ms] (mean)

Time per request:       639.938 [ms] (mean, across all concurrent requests)

Transfer rate:          78.16 [Kbytes/sec] received

I normally get closer to 4 requests a second, but I think the 10 concurrent requests bit may have battered the server into submission. Note that I’m using MySQL query caching, but that it doesn’t do anything with WordPress because of how the queries are structured.

Here we are with WP-Cache enabled:

Concurrency Level: 10 Time taken for tests: 13.88105 seconds Complete requests: 1000 Failed requests: 995   (Connect: 0, Length: 995, Exceptions: 0) Write errors: 0 Keep-Alive requests: 0 Total transferred: 51375145 bytes HTML transferred: 51097605 bytes Requests per second: 76.41 [#/sec] (mean) Time per request: 130.881 [ms] (mean) Time per request: 13.088 [ms] (mean, across all concurrent requests) Transfer rate: 3833.33 [Kbytes/sec] received

You can see a substantial speedup — I’m pulling 76 pages a second instead of 1.5. But 76 pages a second is still pretty pathetic.

With WP SuperCache turned on, the results are considerably improved:

Concurrency Level: 10 Time taken for tests: 1.761982 seconds Complete requests: 1000 Failed requests: 999   (Connect: 0, Length: 999, Exceptions: 0) Write errors: 0 Keep-Alive requests: 990 Total transferred: 51326632 bytes HTML transferred: 51051980 bytes Requests per second: 567.54 [#/sec] (mean) Time per request: 17.620 [ms] (mean) Time per request: 1.762 [ms] (mean, across all concurrent requests) Transfer rate: 28446.94 [Kbytes/sec] received

I’m now able to handle more than 550 requests per second. The time per request has also plummeted: 1.762ms with SuperCache, 13ms with WPCache, and over 600ms (!!!) without any caching at all.