WordPress Performance Essentials – Shared Hosting or VPS

Following on from my last post, Getting Started with WordPress & Nginx, assuming you’ve decided to go down the VPS or Dedicated server route (rather than shared hosting) there are a few things you need to get installed as a priority to ensure good performance. If however you’re unable to use a virtual private server and are planning to run your site on shared hosting, getting good performance is still important.

WordPress by itself is a bit of a poor performer, something which can get progressively worse with every plugin you install; especially if you use lots of database-call heavy tasks such as querying posts, displaying related content, or retrieving random posts / pictures / whatever from the database on every page impression.

A great, simple way to improve this (aside from getting a faster database server or switching to Nginx rather than Apache) is to ensure you have tuned WordPress as far as you can through minimising unnecessary plugins and using a good cache plugin. Once that’s all been done, the next step is to ensure you’re minifying your code as much as possible – a process which takes normal CSS, HTML & Javascript files containing loads of (unnecessary) empty space and removes anything & everything that’s not directly necessary for the file to be understood by a user’s browser. This is a great & simple way to reduce your bandwidth usage & improve site performance, simply though minimising the amount of data that needs to be transmitted with every page.

If you’re using a shared hosting environment, all you can really do to achieve great WordPress performance is to setup caching within WordPress & enable minification. The two plugins I would always recommend to do this are W3 Total Cache & Better WP Minify.

W3 Total Cache is a comprehensive suite of tools designed to improve the user experience of visiting your site through caching nearly everything that your WordPress site does – reducing download times and also providing a simple way to integrate your site with content delivery networks (CDN). It also offers some minify tools to help reduce the size of your pages.

 

Better WP Minify is a dedicated content minification plugin, which helps squeeze your files a little more than W3 Total Cache tends to do by itself.

I always tend to use both of these in tandem, which based on our experiences so far seems to give a pretty good result.

In terms of setting these up, Better WP Minify doesn’t need much configuration other than being installed & enabled, but W3 Total Cache can need some more work to give you the best results as it will benefit from being tuned to suit your web server’s configuration.

 

Out of the box, W3 Total Cache does a fairly good job at assuming a sensible set of default values which will work on most hosts and give you a reasonable degree of benefit to get you going. If your site still isn’t performing too well at this point, unless your current host has some suggestions it’s possibly time to rethink your hosting and perhaps consider changing to a better-performing web host or moving to a VPS.

There’s a fantastic guide to getting started with W3 Total Cache available at c3mdigital.com which works through all the various configuration options, and is something I’d highly recommend taking a few minutes to read.

In essence, most shared hosts only offer relatively basic PHP installations – which tend to limit what you can actually do to improve performance. As a result, all WP caching tools tend to use the same approach with hidden generation of pages going on in the background – meaning that when a visitor browses to a cached page, WP just needs to retrieve the pre-generated page from disk and serve it to the visitor.. rather than needing to process the PHP scripts, retrieve content from the database, run all the plugins that need to be run for the page and eventually assemble everything into a coesive page before serving it to the user.

Flexible, VPS or Dedicated Hosting…

If you either have a flexible host who’s able to install software for you, or have decided to run your own server as a dedicated or virtual private server, then it’s possible to fully harness W3 Total Cache’s capabilities with the addition of a PHP OpCode cache such as APC. This little add-on for PHP gives you the ability to use in-memory caching within W3 Total Cache, meaning that you can get away from using files-on-disk for your caches & hold frequently accessed data objects & pages within your server’s memory. A quick way to produce significant performance improvements with a trivial amount of effort!

If you’re running a Linux distribution that provides a package manager such as YUM, all you should need to do to get started is fire up an SSH or console session to your server & install a few pre-requisites:

yum install php-pear php-devel httpd-devel pcre pcre-devel

 

.. and then install APC using Pear:

pear install pecl/apc

 

That’s it… You should now have APC installed, which means if you return to your W3 Total Cache setup pages you’ll now be able to select Opcode: Alternative PHP Cache (APC)  & watch your site’s performance increase!

 

 

Similar Posts

Leave a Reply