WordPress does a lot of things right. It’s easy-to-use, it’s extensible and it has been widely adopted by the website development community. Unfortunately, WordPress doesn’t do a great job when operating under a heavy load of traffic, especially when residing on a shared hosting server and being combined with a couple of dozen third-party plugins tacked on to it. Fortunately, there are several steps that can be taken to resolve WordPress performance issues.
You might not think that a slowly loading website is all that big of a deal, but page load times have significant implications for your website. People tend to leave websites if they don’t load within a few seconds. Google has stated that page load speed is now a factor in search engine rankings and websites that have slower load times have lower click-through rates and opt-in rates.
I have several recommendations for anyone with a WordPress website that’s suffering performance issues or otherwise have slow load times. I’ve broken down my recommendations into on-site factors (steps to take with your specific WordPress install) and server-level factors (which apply if you are running a virtual private server (VPS) or a dedicated server).
On-Site WordPress Performance Recommendations
Install a Caching Plugin – A WordPress caching plugin, such as HyperCache, WP Super Cache and W3-Total Cache, will create static HTML versions of your WordPress pages and serve them up to visitors instead of creating a fresh copy of a page each time it’s loaded. Installing a caching plugin will significantly reduce your website’s CPU usage. SuperCache is the most widely adopted caching plugin and W3 Total Cache is the most customizable, but I recommend HyperCache because it’s fast and very easy to configure.
Minimize Plugin Usage – Many WordPress users have the bad habit of running 20 to 30 different WordPress plugins at once. Each plugin that you have installed adds to the amount of work that the server needs to do to load pages on your website. Some WordPress Plugins tend to load unnecessary scripts that slow down your website’s page load time. Keep the number of WordPress plug-ins that you have installed to a minimum. If you are disabling plugins, I recommend deleting them from your website. I don’t recommend leaving them deactivated, because there are still circumstances when the plugins code can run even when deactivated.
Minify Scripts – There’s a helpful script called Better WordPress Minify that will automatically compress your JavaScript and CSS files called Better WordPress Minify. This script will reduce the file size of JavaScript and CSS files, which will result in a faster page load performance.
Weed out Unnecessary Script and Image References – Your WordPress theme or a plugin may be loading extra scripts, images and CSS files that aren’t actually used on your website. It’s a good idea to identify these files and prevent them from being loaded with your website to improve page load time. Website Optimization.com has a free service called Web Page Analyzer that will show all of the files that are loaded with your website. Use Web Page Analyzer against your website to identify large files that are being loaded with your website and see if there are multiple copies of scripts being loaded (such as jQuery) or if there are any unnecessary scripts or images being loaded.
Bad Behavior – This step only applies if you know that your site is being hammered by bots or spammers on a regular basis. Bad Behavior is a WordPress plugin that will block spam bots and other misbehaving bots from accessing your website. I only recommend that you run this script if you know you’re getting hammered by bots, because some people have had issues with the plugin.
Don’t Install DB Cache Reloaded – I, and many others, previously recommended DB Cache Reloaded (and its successor, DB Cache Reloaded Fix). This plugin creates a cache of database queries and reduces the load on your database server. This plugin is no longer maintained and I have noticed significant performance problems with the plugin using the latest versions of WordPress. I do not recommend that anyone uses this plugin anymore. If you need to reduce the load on your database server, I recommend using W3 Total Cache’s database object cacher.
Consider a Content Delivery Network (CDN) – There are several services, such as MaxCDN and CloudFlare, that cache files from your website on their network of servers to reduce the number of requests made to your website and improve the page load time of your website to visitors around the world. These have benefits in some circumstances, but are not a panacea and tend to be overkill for most WordPress installs. CDN’s tend to speed up the serving of static files (images, CSS files, JavaScript files), which is typically not where WordPress struggles.
Server-Level Performance Recommendations
These recommendations only apply if you’re running a dedicated web-server or are running a virtual private server (VPS). If you’re a BlueHost, DreamHost or HostGator customer that’s on a shared server, these recommendations don’t apply to you. If you don’t know whether or not you’re on a dedicated server or a VPS, you’re on a shared server.
Use a Fast PHP Handler – If you’re running WordPress, you’re most likely running a Linux-based Apache web-server. Apache makes use of a PHP Handler, which simply refers to has the specific implementation of PHP that your web-server makes use of. The three that are most widely used are DSO, SUPHP and FCGI. Although SUPHP is very common, it tends to be slower than DSO and FCGI. If you’re using SUPHP and are having performance issues, consider switching to DSO or FCGI. You can read more about PHP handlers at this link.
Install a PHP Accelerator – There are three Apache add-ons that precompile PHP scripts for improved performance, which are APC, eAccelerator and XCache. I do not recommend eAccelerator since it no longer appears to work well with WordPress. I have personally had good luck with xCache and would recommend it to other WordPress users.
(I operate multiple WordPress websites that receive tens of thousands of page views each day that reside on a dedicated server that I’ve leased from a hosting company. Several of my sites have more than ten-thousand posts on them. In other words, I’ve been around the block several times when it comes to WordPress performance issues.)