WordPress Performance Tuning Tips

Here are my top five WordPress performance tuning tips.  If you have a poorly performing blog, you may want to try some of these procedures.

What Do I Mean By Poor WordPress Performance?

I don’t mean that you have no readers or comments or that your content is not very good, that is up to you ;) what I mean is that your pages are rendered very slowly and the usability of your site to open posts or pages, search for content or pull things back from your archives makes your visitors experience very poor and possibly turn them off from yoru site altogether.

There is also a school of thought in SEO circles that slow loading sites are not as well regarded as a fast loading site.  So poor performance could be effecting your search engine ranking.

Before we begin

All of this is information is fairly technical, please backup your site before your begin. I offer a wordpress performance tuning service if you would prefer to hand this over to me. request a quote from my WordPress Technical Support page for details

Here we go, my top 5 tips for improving WordPress performance:

1. Install a Cache Plugin

Cacheing in computer speak is when you take information usually recovered from back end database and hold it in memory or on disk.  When the information is next requested it is served up from the very fast memory/disk store rather than recovering it from the slower backend storage.  The cache is held for a set lifetime and then renewed once the cache has timed out.  This means only one access of the backend is requried for a set period of time.

Think of your blog home page, it is fairly static so loading all of the logo images, blog posts, CSS files etc etc into memory and serving them up can save a lot of time.

The plugin I recommend is wp-super-cache, this can be downloaded from http://wordpress.org/extend/plugins/wp-super-cache/

UPDATE: I now recommend w3-total-cache it’s mninify and CDN capabilities knock the socks of wp-super-cache http://wordpress.org/extend/plugins/w3-total-cache/

A word of warning on using a cache, if you use dynamic content on your pages for example an adrotator where each page load should show a differnt banner ad, using a cache will cause this to fail and only show one banner.  wp-super-cache w3-total-cache has the ability to mark certain scripts or comands as not for cache.

2. Activate the Inbuilt WP Object Cache

WordPress comes with it’s own inbuilt object cache. this allows you to save certain database queries to disk, and recover them much more quickly than accessing the database.

To activate the inbuilt cache you need to edit the file wp-config.php.  This will be held in the root of your blog installation.  To activate the object cache, add the following line ot your wp-config.php file:

define(ENABLE_CACHE, true);

3. Reduce Plugins

Everytime we add a plugin to our blogs, we add an overhead.  Every bell and whistles on your home page needs ot be rendered and displayed.  This will slow down your blog.  My recommendation is to remove all plugins which are not entirely needed on your site.

I wrote an article about performing a plugin audit earlier this year, why not use that as a tool to find out if you need a particular plugin

Database SQL Cache

The query cache holds regularly run queries in memory to speed up the return of database results.  We are getting into real techie land here, and that is to check if your back end MYSQL database has a query cache installed and how big it is.

If you are not happy messing about with your database why not submit a technical support request to your hosting company to do this for you.

To find out you have a query cache installed and it’s status, run the following queries from a MYSQL tool such as PHPMYADMIN

SHOW VARIABLES LIKE ‘have_query_cache’;

This will return a yes or no value, if it is no ask your hosting company to activate a cache.

To show the status of the cache run:

SHOW STATUS LIKE ‘Qcache%’;

This second command will tell you how the cache is being used and if it needs to be tuned.  Here is an excellent resource from the MYSQL site which tell syou much more about query cache settings and configuration.

http://dev.mysql.com/doc/refman/5.1/en/query-cache-status-and-maintenance.html

5. Look to Your Hosting

This is my last but least popular recommendation, and that is to look at your hosting provider.  You may be in the enviable position that your blog has grown so popular that you have out grown your hosting account, or you may be  too cheap, I bet that $3 per year hosting account doesn’t look so good now it takes ten minutes to load your blog.

If you are still having performance problems after the first four steps, look to upgrade your hosting to a more powerful setup, this will cost more money, so you will need to weigh this against the value of your blog.

Checking Performance Improvements

You need something to prove that the performance changes you have implemented have provided an increase in speed, you can spend lots of money on traffic analysers to look at the underlying http calls and see response time, me,I go for cheap and cheerful everytime, I use the basic (read free) version of httpwatch a browser plugin which shows your page being rendered and what is taking the time, a very useful tool.  The key point is I can use it to do a before and after comparision of page load time.  It also shows me which components are being cached.

Wrap Up

Performance tuning any computer system is a dark art, where you tune in one place you can introduce new bottlenecks elsewhere.  This list is not exhaustive, there are tweaks to php.ini, your web server config file, or you could be having performance problems due to incompatible plugins or themes making outdated DB calls.

My advice change one thing at a time and roll it back if you see no improvement.

UPDATE: WordPress Users And Roles Training Available

I have recorded a video training session on WordPress performance tuning for my WordPress training and support community the WP Owners Club.

I’ve got a 14 day free trial at the moment, why not take out trial membership and check out the training, here’s what you need to do

1) Sigup for a 14 day free trial account at wpownersclub.com/sign-up

2) Go to http://wpownersclub.com/performance-tuning-workshop and watch your training


Need Help With Your WordPress Site?

Why not hire A WP Dude to help solve your WordPress Issues

Get Full Details

5 Responses to “WordPress Performance Tuning Tips”

  1. Antoine August 13, 2009 at 10:08 am #

    Hi, I tried optimization #2 adding (define(ENABLE_CACHE, true); to my config file. I did not work, I had no access to my blog during several minutes!

    • Neil Matthews August 13, 2009 at 10:21 am #

      Hi Antoine,

      Sorry to hear you had problems, I have done a search for possible problems with wp object cacheing and found this :

      Object cache may cause performance penalty when the available memory is low and too many Apache processes are allowed. With caching enabled each Apache process (or Thread), serving a WordPress page request, caches at most 124 php objects which can increase memory consumption.
      As a result kswapd (swap manager) comes into play and at high loads it tends to swap too often and ends up consuming most of the CPU cycles itself instead of allowing actual processing.
      So if you are on a low end machine with low RAM or if you are sharing the machine with lots of other users then you can experience performance issues. However you can easily solve it by either increasing the memory or reducing the maximum number of Apache processes you serve. In short object cache can be used to improve your performance.

  2. Antoine August 13, 2009 at 10:43 am #

    Thanks for your reply. I rebuilt my config file from the beginning and everything is fine.

    I think my hosting is quite bad (OVH).

  3. Anastasia June 27, 2011 at 7:47 am #

    This is great article, i was searching something like this for a while. Thanks for your kind writeup. Keep it up

  4. David Hicks January 11, 2013 at 3:18 pm #

    My site is the beginnings of a multisite.

    I installed w3-total-cache and it seems to really speed things up but I noticed it also seems to have broken my rendering to mobile devices. I now get downloads of random_name-1.part to the mobile device. I have yet to do any of your other recommendations but will be looking at each. In the mean time do you know of a way around this issue with mobile devices (a setting in the plugin) or do you recommend a specific template that works better with the plugin (I’m using Twenty-Eleven v1.5 on WP 3.5)

    Thanks