How to speed up WordPress

In my last post, I was wondering how to fix the issues people were having leaving comments on this site. Attempts to leave comments were timing out and the comments were not being posted.

Fortunately I had lots of great suggestions from readers on how to resolve the issues and I think it is now fixed (famous last words?).

The fix also seems to have had the knock-on effect of drastically speeding up the site – wohoo! A big thank you to everyone for your great suggestions.

The steps I took to resolve this were:

  • I turned off this theme’s Ajaxy live commenting
  • I cleared my moderation list and my blacklist
  • I updated Akismet to the latest version (1.2.1)
  • I activated WordPress’ object cache by adding define('ENABLE_CACHE', true); after the define WPLANG; line in wp-config.php

Of those changes, the last one (suggested by James (aka MacManX)) appeared to have the most dramatic positive effect. The site is now running way faster and comments seem to be posting successfully.

This site averages around 1750 unique visitors a day according to Awstats and about 3-4 times that according to Webalizer (Awstats strips out visits from robots/spiders/bots, etc.) so I am guessing that the comments were timing out because the site/server were under pressure.

Turning on the WordPress object cache took the pressure off and is now letting the comments through.

Sincere apologies to anyone who had problems recently leaving a comment on this site – hopefully it won’t happen again.

11 thoughts on “How to speed up WordPress”

  1. Tom, I’m glad to hear that everything is working properly, and I’m sorry that I didn’t think of the object cache sooner. With the cache in place, you should be able to reactivate the “Ajaxy live commenting” without any significant performance impact.

    Milan, the WordPress object cache was introduced as a default feature in WordPress v2.0, but has shipped as disabled by default in all releases of WordPress since v2.0.2. The object cache works by caching certain database queries, which can be a great benefit to your blog if your MySQL server is slow or overloaded. It has been known to cause a negative performance impact under some shared hosting providers with blogs whose traffic does not justify the use of a cache.

    I began using the object cache on MacManX.com after I installed Angsuman’s Translator Plugin Pro, which uses WordPress’ object cache to cache translated pages, thus speeding translation and lightening the load on the translation engines. If my blog receives enough traffic to justify the use of the object cache without any negative performance impact, then Tom’s should do just fine.

  2. James – you got to comment ok using the name James I see, great!

    No worries, thanks for giving me simple instructions on how to turn on the caching! It seems to have worked a dream. And the fact that it is in the wp-config.php file means that it is unlikely to be overwritten in upgrades (or if it is, I have bigger things to worry about!!!).

  3. Dave,

    I know I tried it in the past but I had issues with it so I uninstalled it.

    The issues were around my tinkering with the site’s design and wondering why the changes weren’t showing up on the site (yup, I was looking at cached pages – duh Tom!).

  4. Is that single line all you need to add to the wp-config.php or are more complex modifications required? Would this be at all worthwhile on a blog that only gets about 100 unique hits a day, and is running on a shared (GoDaddy) Linux server?

    Thanks a lot for the information.

  5. Milan, the WordPress object cache is built-in. It just needs to be “turned on” by following the steps that Tom mentioned in his post.

    In my opinion, a blog with 100 unique hits per day is border-line when considering the object cache, which means that it may or may not benefit from the cache. Just activate the object cache for a few days and keep a close eye on your blog’s performance.

  6. Thanks for the heads up on the cache function built into word press. I had tried to use the wpcache2 plugin on my site – but it wouldn’t work because we can’t create the symbolic link. thanks for the tip!

  7. Hey, if you still want to speed up your site using cache, there’s an amazing plugin called wp-supercache. It has done wonders for my client’s WordPress installs.

    When you used caching in the past, you mentioned being frustrated about making design changes and not seeing them live on your site. A quick way around that is after making design changes, you go to the wp-supercache settings in your admin and just hit ‘Delete Cache’ and you’ll see the changes applied.

    If you want to try out the plugin you can read about it on my blog:
    http://www.widecastmarketing.com/wordpress-tips/speed-up-wordpress-performance.html

Comments are closed.