Tuning Wordpress for Speed

Martin on March 27th, 2008

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

  1. An aging, but working AMD Sempron(TM) 2200+ @ 1500Mhz with 1Gb of memory.
  2. Ubuntu 6.1 server
  3. Apache2
  4. PHP5
  5. Wordpress 2.3.3
  6. 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

  1. How to enable mod_rewrite in Ubuntu server?? - Ubuntu Forums
  2. Antiguo y abandonado blog de Ricardo Galli :-( ยป WP-Cache 2.0
  3. eAccelerator - Trac
  4. Installing eAccelerator in Ubuntu Server | Security Viewpoints
  5. Welcome to the httperf homepage

Subscribe to this blog's RSS feed

When a visitor comes across your website in Google what is the first thing they notice? And what is the second thing they notice?

The first thing to hit your eyes is the title. And in this example my blog is giving a boring, non-descriptive introduction to my site. It is just the title and [...]

Continue Reading...

Speeding up Wordpress with WP Super Cache

Martin on March 24th, 2008

A Really Fast Wheelie by DavidHT
Your moment of fame has arrived and with it the unwashed masses of the Internet flock to your site to gawk at your latest insights. As you have bought the promotion priced hosting with its retirement age web server it dies a horrible dead just seconds into the rush.
No budget [...]

Continue Reading...

A human readable sitemap

Martin on March 24th, 2008

In an earlier post I touched on the sitemap.xml file, and how it is used by search engines to quickly detect any changes made to your website and to make sure that they do not miss a page when indexing your site.
An older but also tried approach is the human readable sitemap. Not only [...]

Continue Reading...

Plugin: Google XML Sitemaps

Martin on March 24th, 2008

In the good old days, web spiders employed by the search engines has to earn their keep. They had to crawl each page to find links to other pages and so slowly discover the world wide web. Its a good way of finding every page, but it is also very time consuming.
Chewing on their [...]

Continue Reading...

Setting your Blog on Fire with Feedburner

Martin on January 22nd, 2008

The first stones are in place, you are no longer looking at the default blue wordpress theme and your first blog entries shine on the front page. Or maybe you decided to skip of all this and got right to this point. Its a free world.
Now you need to promote your blog, and one [...]

Continue Reading...

Permalinks - Looking Good

Martin on January 21st, 2008

If you have just installed Wordpress you will notice that every post you place on the Internet has a url looking a little like:

This works great but certainly is not too slick. So go to the “Options” tab in your Wordpress Dashboard, and then click on the “Permalinks” tab. Here you can modify how [...]

Continue Reading...