A few weeks back, I gave some tips for how to speed up WordPress on a VPS. Several readers suggested using WP-SuperCache. This is a good suggestion, but in my case, it didn’t work.
After a bit of investigation, I discovered that the load issues appeared to be coming from the WordPress admin panel. As far as I’m aware, WP-SuperCache won’t help here, so I looked for an alternative.
Introducing the Object Cache Plugin
I had to do quite a bit of digging to find the Object Cache plugin, which is basically a drop-in. But first, you need to install memcached, followed by the PECL memcache extension.
Partway through the process, I got a bit stuck – I couldn’t find a current version of libmemcache. Never fear, there’s a blog post that might help: Installing memcached and libmemcache on Debian.
A Hitch: Multiple WordPress Installs on the Same Server
Setting up the Object Cache plugin for one blog worked a treat. Suddenly, everything started moving again. However, it all went a bit wrong when I added the plugin to another blog on the same server (not using multi-site capabilities). Logging into the second blog sent me back to the first.
To solve this, I found that you can force a unique string to be added to the memcache key by modifying the object-cache.php file slightly. This post explains how to do it: Using memcached with WordPress object cache.
Note that the version of object-cache.php is older than the one from the plugins repository, though, so it’s probably safer to make the changes yourself. Look for the “key” function and replace it with the following:
The Result?
Fast loading blogs. Low server load. And I’ve learned a bit more about WordPress in the process.
Of course, there may be less of an issue if you use WordPress’s multi-site capabilities, but I’m not quite ready to do that just yet. If you have more than one WordPress installation and you have access to the command line, this may be a good option for speeding up the admin panel.
Photo by Mykl Roventine: Out & About