Enhancing the performance of your WordPress site is important to your site visitors as well as to the search engines. There are numerous things to consider when it comes to speeding up WordPress.
Benchmark your Site
Before attempting to increase the performance of your site you need the ability to measure the performance of your site. There are several online tools that can be of assistance.
Google’s Webmaster Tools do not provide realtime data but are very useful in that they will track the responsiveness of your site over time. This is a very convenient way to keep track of changes over time.
In some cases a realtime result is desired. Pingdom’s Full Page Test is a popular tool that will do a realtime test of the performance of your site. It breaks down the delays encountered along the way which can help to identify the slower areas of your site.
Webwait.com offers a quick and simple way to measure how long it takes to load a specific URL from your site. Webpagetest.org is a little more extensive in that it allows you to pick from several locations to test from around the world, as well as which web browser you would like the test performed from.
Use an optimized Theme
There are countless WordPress Themes available online which are both free and otherwise. Many of these are built by designers who are not familiar with optimization and performance or simply had other goals in mind. There are some cases where aesthetics do outweigh performance, but this is an article about speeding up WordPress.
With performance in mind it is best to avoid themes that are heavy with their use of images (think : less is more). This is particularly true when the images are rather large and have not been optimized. Avoid themes that use a lot of Flash for similar reasons.
WordPress themes which are built on Html5 and CSS3 can often be more compact as a result and therefore perform better in modern browsers. Smashing Magazine’s CSS3 versus CSS : A Speed benchmark demonstrates a real world case study where CSS3 was able to :
- Reduce site production time.
- Reduce future site upgrade time.
- Decrease the volume of images a site uses.
- Decrease the number of Http requests needed to communicate with visitors.
The first default WordPress theme to use Html5 out of the box was Twenty Eleven. It performs quite well as it is and as a result there are many child themes built for it.
While editing a post you may have noticed WordPress saving a draft of your post in the background every minute. This is known as the Autosave feature. There is only ever a maximum of one autosave for any given post. New autosaves overwrite old autosaves and do not create new post revisions in your database.
Every time you click on Save Draft a new revision of your post is stored in the database. This feature can be a life saver if you should ever loose your Internet connection (for whatever reason) while updating a post. In this case you would be given the opportunity to restore content from a previous revision of your post or from the autosave version.
Another example of the value of post revisions is when you had previously removed some of the content from a post that you later wanted back again. Post revisions are like time machines for your WordPress site.
There is a cost to the convenience of post revisions that is paid-for behind the scenes as they begin to grow in number. When a visitor requests a particular post from your site, WordPress has to search through all of the posts (and revisions) in order to locate it. This will obviously take more and more time as the amount of posts (and revisions) on your site increases.
By default WordPress will store an unlimited number of post revisions per post. You can alter this behavior easily by editing the wp-config.php file. You can turn off post revisions altogether, or simply limit the number of revisions you want to store for each post.
Unlimited Post Revisions (default) :
Limited Post Revisions (in this case 7) :
Turn OFF Post Revisions (not recommended) :
In the future, WordPress may have built-in support for deleting post revisions. In the meantime, there are several plugins that can perform this and manage your post revision preferences in general. One example is the Revision Control plugin.
Another way to help WordPress find posts more quickly is to ensure that you are using a permalinks structure that preceeds your post’s name with a number. Below is a direct quote from the WordPress Codex that helps to explain this further.
For performance reasons, it is not a good idea to start your permalink structure with the category, tag, author, or postname fields. The reason is that these are text fields, and using them at the beginning of your permalink structure it takes more time for WordPress to distinguish your Post URLs from Page URLs (which always use the text “page slug” as the URL), and to compensate, WordPress stores a lot of extra information in its database (so much that sites with lots of Pages have experienced difficulties). So, it is best for the first structure tag to be a numeric one, such as /%year%/%postname%/. (Some people recommend /%post_id%/%postname%/ which works for performance reasons but others recommend against it because it is unfriendly to users in the many contexts in which users interact with URLs.)
Many proponents of SEO (Search Engine Optimization) will insist on using a permalinks strucutre of /%postname%. The reasoning is to avoid diluting the benefits of the URL being as close to the targeted keyword phrase as possible.
This approach will work fine for smaller sites but quickly becomes a problem with larger sites where using a number to precede the %postname% will help WordPress find the requested posts much more quickly. Here are some examples of permalink structures which would help avoid the aforementioned performance issue of larger sites :
/%post_id%/%postname%/ /%year%/%postname%/ /%year%/%monthnum%/%postname%/ /%year%/%monthnum%/%day%/%postname%/
A very important consideration with regards to the performance of your site is the performance of the server your site is hosted on. If your WordPress site is hosted on a server shared by hundreds of other sites (Shared Hosting), this could result in inconsistent performance. Your Web Host simply cannot ensure what those other sites are up to or how they might effect your site’s performance or availability.
A VPS (Virtual Private Server) also shares a single server with multiple sites. However, the number of sites is far fewer and the server’s resources (cpu/ram/bandwidth) are managed much more reliably. In many ways it’s like having your own dedicated server.
Ultimately nothing is better than a dedicated server where the entire computer is for your sole use. Expectedly, moving from shared hosting to a vps or dedicated server will increase your monthly hosting fees and so you must balance this out with your requirements. For example, there is no need to get a dedicated server until you have a very large volume of traffic visiting your site.
Optimize your Images
Images are a very common performance killer on Websites. Check out our article on creating Efficient Background Images for your Website for a little background (no pun intended) on some of the fundamentals.
Yahoo has a wonderful Image compression service called Smushit. If you have a larger Web Site full of images, it could take a long time to download, optimize and then upload your results using a tool like this. The results can be quite good though and can often reduce image file sizes by a third of their original size.
There is a terrific and free WordPress plugin available that automates this process behind the scenes. WP Smush.it will automatically compress the images on your Site using Yahoo’s API version of Smushit.
Use a Cache Plugin
A cache plugin can help increase the performance of your website substantially. This is particularly true when your site is suddenly overwhelmed with a large number of visitors.
Caching plugins work by creating static versions of your site’s individual pages as they are requested. This means there is no underlying logic running on the cached page such as PHP or database queries. This leads to a large improvement in performance in many cases.
Caches typically have a lifetime associated with them. For example, a common setting is one hour. This means that the plugin will only allow a full dynamic generation of a particular page once per hour.
There are several caching plugins available for WordPress including the following below :
Enable HTTP Compression on your Server
In some cases, enabling HTTP compression on your server can reduce the download size of your site’s textual content by as much as 75%. While it does nothing for images or other forms of media, Http Compression works by crunching your site’s underlying text and markup.
If you do not know if your site is currently supporting compression there are free utilities online that can help. WhatsMyIp.org has a handy and free Http Compression checking service. Enter the URL of your Site and you will know if your site has compression enabled or not.
Turn on HTTP Compression using cPanel
If your site is managed with cPanel, these options may or may not be available to you. It depends upon your Web Host. They are confirmed to be available to Hostgator clients who use the Reseller Web Hosting package and should be available on most VPS or dedicated servers as well.
Login to cPanel as you normally would and scroll down to the Software/Services section. If you are lucky you will find an option entitled php.ini EZConfig. Note that the appearance might be slightly different depending on which cPanel theme you are currently using.
After selecting the php.ini EZConfig icon you will then see a button labelled “Enable EZConfig”. Click on this button and you will be presented with a whole range of options that you can toggle or tweak.
We are particularly interested in turning ON zlib.output_compression. After doing so, scroll all the way to the bottom and click on the “Save Changes” button to enable Http Compression. Revisit the Http Compression test (see above) to confirm your success.
As you can see there are several things to consider with regards to speeding up WordPress. The ultimate goal of this article is to help assist you in making for a responsive end user experience that benefits your site and it’s visitors.