Tuning Wordpress for Speed

Six string bass of unknown origin by greefus groinks
After writing an earlier article about WP-Super Cache I became curious how much difference the various tweaks make in performance. So I setup a little Ubuntu test machine. After downloading Wordpress 2.3.3 I set it up with some basic posts and the default theme.
The default theme is very simple and when compared to most blogs contains only the bare essentials.
The test environment
- An aging, but working AMD Sempron(TM) 2200+ @ 1500Mhz with 1Gb of memory.
- Ubuntu 6.1 server
- Apache2
- PHP5
- Wordpress 2.3.3
- Mysql 5.0.24 (on the same server)
To test the server responses, another Ubuntu desktop was used with httperf to test the server responsiveness. For each test, the server has to return 1000 copies of the Wordpress frontpage as fast as possible. The results are measured in pages per second.
Test #0 : Static Page -> 568 pages/sec
To benchmark the basic apache2 configuration I saved the Wordpress front page as a static file and tried to see how quickly the server could return this.
Test #1 : Vanilla installation -> 3.05 pages/sec
This was the basic installation of Wordpress with no optimizations made at all.
Test #2 : eaccellarator -> 6.5 pages/sec
The first optimization was to compile eaccellarator into PHP5. This module helps out by storing the compiled PHP scripts in a cache saving PHP from having to re-compile all scripts on each refresh.
This doubled the performance — but the server still needs to query the MySQL server for each page.
Test #3 : WP-Cache-2 -> 26 pages/sec
One of Wordpress most popular extensions — WP-Cache improves performance by storing earlier generated pages on disk. Therefore there is no need to re-query the MySQL server anymore. However PHP is still loaded, and Wordpress still goes through quite a bit of initialization before showing the static pages.
Test #4 : WP-SuperCache -> 426 pages/sec
This plug in takes WP-Cache-2 to the next level. It creates a set of rewrite rules for Apache allowing it to directly fetch each page from disk. This saves loading PHP and initializing Wordpress. These savings make your Wordpress blog a whopping 16 times faster than when using just WP-Cache2.
Results
| Static Page | Vanilla | Eacellerator | WP-Cache2 | WP-Super Cache |
| 567 | 3.2 | 6.2 | 26.6 | 407 |
| 571 | 2.9 | 6.5 | 24 | 427 |
| 571 | 3 | 6.7 | 26.4 | 436 |
| 565 | 3.1 | 6.6 | 27 | 434 |
| 568.5 | 3.05 | 6.5 | 26 | 426 |
Conclusion
It definitely pays off handsomely to invest some time in optimizing Wordpress. Most hosting providers will provide a PHP accelerator such as eaccellerator standard, but beyond that you need to tweak things by yourself.
The benefit of using a cache is very much in the freedom it gives you to customize your blog. You no longer have to worry about the overhead each module adds to generating a page. Most of your visitors will not log in and so there is no need for the performance hit of building a customized page for them on each request.
References

Thanks for benchmarking! Nice to see super cache performed so well.
Thanks for the Supercache plugin
I am having great fun with how it works.