James Jefferies and ShedCode Ltd

The world of James and ShedCode

Updating WordPress Performance

| Comments

Vanilla WordPress performance isn’t great, each page has to be generated via PHP per view, which soon starts to bog your server down under load. Fortunately there are some plugins and tweaks you can make to improve performance and resilience.

Any PHP or Apache gurus out there, feel free to comment and let me know where I’m going wrong, I don’t claim to be a PHP environment expert!

Caching plugin

I’ve generally used W3 Total Cache which provides a number of different levels of caching, including the PHP itself if the relevant apache modules are installed. You can even delegate data to a CDN if that’s your thing.

But before installing the plugin, let’s get everything ready for optimising it.

PHP Performance

To get the full benefit of a plugin like Total Cache, you need to add a few modules to Apache and PHP.

Install DotDeb repository

The DotDeb repository is set up for Debian boxes with up to date versions of common packages.

Instructions are straightforward and involve adding their repository.

Install fpm

fpm is a FastCGI process manager.

sudo apt-get install php5-fpm

Install apc

apc is a PHP object cache. It’s required by W3 for doing the PHP caching.

sudo apt-get install php5-apc

Install mod_expires apache module

The caching plugin works better with mod_expires installed.

sudo a2enmod expires

You should get a response like

Enabling module expires.
Run '/etc/init.d/apache2 restart' to activate new configuration!

Install mod_headers apache module

.. and with mod_headers installed

sudo a2enmod headers    

You should get a response like

Enabling module headers.
Run '/etc/init.d/apache2 restart' to activate new configuration!

Do a graceful apache restart

sudo /etc/init.d/apache2 reload

Once you have restarted, have a look in your apache logs for any thing unusual.

Now install W3 Total Cache

Once installed and activated, the first thing to do is run the compatibility check to ensure that everything is ok.

Then you can start enabling features.. and hopefully see some response time improvements!