Your WordPress blog getting sluggish? Caching is a great technique for speeding up your blog and the WordPress community has a lot of caching plugins to choose from. Lets review each one and find out which caching solution will work best for your WordPress blog.
Newer versions of these plugins may be available. These benchmarks may not accurately reflect the current version of any of the plugins listed below. From this post, you should take away some important abilities of these plugins, but attempt to do some testing of your own.
- What Is Caching?
- WordPress Caching Plugins Compared
- Do It Yourself Caching
- What Not To Cache
- Final Results
What Is Caching?
Each time you visit your blog, WordPress will go through a sometimes lengthy process to build everything you see. First it will process the PHP code which will make numerous calls to your database and finally output HTML for your web browser to display. On some blogs this could happen between 20 to 200 times per page! WordPress has often been criticized as slow but we can change that by enabling caching. If you enable caching only the first visitor will go through this entire process. The caching mechanism will save the data and then serve every subsequent visitor the final result. Thus speeding up WordPress by a huge factor. Trust me, you want it and your visitors will thank you for using it.
I’m not going to test on a fresh install of WordPress because I want to simulate a real world every day blog rather than an unrealistic empty blog. This is the same reason I decided to host the test blog on a shared server. My goal is the average and most of us probably have our blogs hosted on a shared server with minimal optimizations specifically geared towards WordPress.
First we are going to run a benchmark with caching completely disabled. This will give us a control test to compare the performance of each plugin.
Yikes, 13.96 requests per second is pretty bad but I can’t complain. WordPress is really slow without any performance tuning and my test blog is running on a $10/mo shared server account. Sometimes you really do get what you pay for. Lets see if we can get more out of this not so ideal predicament.
WP-Cache is a simple and aged cache plugin. Although it has been around for a long time it also hasn’t been updated in a long time. WP-Cache was an easy plugin to install but it does create a few files outside of the plugin directory and doesn’t clean up the mess when you uninstall. Some users may get the error message “sem_get” on the top of every page of their blog. Just edit the file wp-content/wp-cache-config.php and uncomment the $use_flock line. That will fix the error message if your server doesn’t support the sem_get file locking command.
WP-Cache is tried and true. Even for its age and lack of updates, WP-Cache is still a contender and a very light weight one at that. Overall performance and installation could definitely be better though.
WP Super Cache
WP Super Cache is a very popular plugin once based on the previous WP-Cache plugin and it is routinely praised among many WordPress communities. Overall it was somewhat easy to install and uninstall. Cleans up its own mess when deactivating which is always nice. I got a “gzuncompress” error message only once after activating but it didn’t appear to affect operation of the plugin. You have to manually create an .htaccess file but at least it gives you some code to copy and paste. This plugin has a long page of endless options and the user interface could certainly use some cleaning up. Be sure to follow the directions carefully after activating. Especially pay attention to the directions on creating a proper .htaccess file.
With Compression Turned On:
Be Careful Enabling Compression If you enable WP Super Cache Compression and your server already has compression enabled or doesn’t support it then you will get a lovely blank page of death or just a lot of garbage printed on the screen. Use with caution.
Something seriously wrong is obviously happening when compression is enabled. Despite what the people say, WP Super Cache isn’t very super. In my opinion it is a complicated version of WP-Cache with only slightly better performance. With numerous reports of blank pages of death, I am hesitant to install this plugin on an actual blog. On top of it all this plugin doesn’t seem to play nice with others. Improper configuration and/or a bad plugin combination can lead to a drastic decrease your performance. It is sad but true.
WP Widget Cache
WP Widget Cache is a plugin geared toward those with heavier widget use. My test blog, only using the default widgets, may not have completely benefited from this plugin. The author recommends running this plugin along with either WP-Cache or Super Cache so I will run 3 tests: Standalone, with WP-Cache and with WP Super Cache. WP Widget Cache was very easy to install and uninstall. Just clicked activate and since my wp-content folder was writable everything installed automatically. In order for this plugin to work you must goto your Widget settings and set the expire amount field on each widget. Standalone:
With WP Super Cache:
This plugin would be useful to those who use database intensive widgets on every page. Other cache plugins will process then cache your widgets for every page. This plugin will cache your widgets and serve your other cache plugins a copy as they save each page.
Some Widgets Should Not Be Cached If your widgets are dynamic or change on every page then of course this plugin will be of little use to those widgets. Make sure you set the expiration to empty or 0 seconds on your dynamic widgets to prevent caching.
The DB Cache plugin works very different than the others. Instead of building and saving your pages it saves the database queries instead. This plugin is available in many different languages. Installation was very easy and the user interface is simple and clear. Cleans up great upon deactivating.
DB Cache is more for the server administrator. Caching pages, especially if you have a lot of pages on your site, can be very CPU intensive and they take up a lot of disk space. If you run and optimize your own web server then this plugin will be good to you. Although if your blog is on a shared server or has fewer than 500 pages then this plugin may not be as beneficial to you.
DB Cache Reloaded
DB Cache Reloaded is similar to DB Cache. In fact it is a fork of DB Cache because the author didn’t think DB Cache was updated quick enough. This plugin is also available in many different languages. Installation was very easy and the user interface is simple and clear. Cleans up great upon… ok, ok it is really similar to DB Cache. Lets just call it DB Cache Reloaded… oh wait, it already is.
Just think of it as the same as DB Cache but better.
1 Blog Cacher
1 Blog Cacher is a lightweight and simple caching plugin. Not very popular but I’ve seen it recommended on more than one occasion. Installing this plugin was annoying. I had to manually create the folder wp-cache, move the file 1blogcacher2.0.php to the wp-content/plugins folder and move advanced-cache.php to the wp-content folder. The user interface is terrible and the options are not editable through the admin settings. Everything must be configured directly in the advanced-cache.php file. Terrible for a multi-user setup or those who don’t want to FTP into their account every time they wish to make a configuration.
I don’t think this plugin even works despite appearing to have done something by adding a message in my source. The author says its version 2.0.2 but it almost seems like a plugin that is still in beta. Easily the worst caching plugin I’ve encountered.
Hyper Cache is a new caching plugin out in the community. It is geared towards the everyday blog or those hosted on low cost shared servers. Also available in many different languages. Installing was a simple upload and activation. This plugin has a lot of great configurations and organized appropriately in a clean user interface.
Hands down the fastest caching plugin I’ve reviewed and surprising for how light weight it is. It may just be me but my blog just seemed to click on rather then load with this plugin enabled. Definitely for those hosted on a shared server or who are looking for as much caching performance from a plugin as possible. The development around this plugin looks very active too. A definite must have plugin especially if you plan on configuring your own additional performance tweaks such as minifying, db caching or compression.
W3 Total Cache
W3 Total Cache is the mother of all caching plugins. It is huge, well documented and packs in an impressive amount of performance configurations all into one plugin. Installation was surprisingly easy. With all the options available I thought I was going to be here all day configuring this beast. After activating it automatically best guessed an optimal configuration. Great for those who just want to install and go.
If you’re looking for a plugin that does everything then this plugin is your golden ticket. From multiple methods of page caching, minifying, database caching, content delivery networks… this plugin does it all. They even have support request available and built right into the plugin. Now to avoid sounding too much like a car salesman lets review the cons. First, it is huge. Even though disk space is becoming less and less of an issue there are some blog admins out there that either don’t have or want to spare the space. Second, it is fast but not the fastest caching plugin out there. Especially if you disable the minifying and compression built into the plugin. Then it runs on a more equal footing with the other plugins reviewed here.
Do It Yourself Caching
Who said you have to use a plugin to cache your blog? Caching pages yourself can sometimes be the best solution, especially for those high traffic and rarely changing pages in your blog. It does take a bit of manual labor though. First create a folder called cache in your wp-content folder. Visit the page on your blog that you would like to cache then view the source. Copy the entire source into a file named relevant to the page you are caching. For example if I want to cache my about page I would name the file about.html and put it in my wp-content/cache folder. From here we need to create a .htaccess file in your root WordPress folder. Copy the following code into your .htaccess file.
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^about$ wp-content/cache/about.html </IfModule>
Using mod_rewrite we are telling the server to deliver the contents of the wp-content/cache/about.html file when someone goes to http://yourblogurl.com/about. I suggest learning more about mod_rewrite before manually caching a bunch of your pages. A handy solution though because from here you can perform other tweaks directly to the file such as minifying. Manually creating the files will also save a great amount of CPU load, which is critical for high traffic servers.
Although it is a lot more work then using a caching plugin; caching pages yourself does deliver high performance. Just remember your manually cached pages will not and can not be updated through WordPress and you must continuely update your cached pages by hand. This is a viable solution for those static high traffic pages but not an ideal solution for most bloggers.
Combining some of the plugins can lead to an increase in performance such as Hyper Cache + DB Cache Reloaded. Although some combinations will greatly decrease performance such as WP Super Cache + Anything. Try combining and see what works for you.
What Not To Cache
Overall the best out of the box cache plugin configuration in my opinion is: Hyper Cache + DB Cache Reloaded. Despite the allure of W3 Total Cache’s professionalism and only slightly less admired performance, I prefer to retain some manual control over my blog. For those on a medium priced shared server or if you like the idea of installing and forgetting, the W3 Total Cache plugin will be your ideal choice. A lot of people still use WP-Cache and WP Super Cache. They are still respectable WordPress caching plugins but consider trading up for Hyper Cache or W3 Total Cache. These newer caching plugins prove better performance and install/config much easier and cleaner. Also the development communities around these newer plugins are much more active and attentive to their users. I hope I’ve helped you in choosing the best caching solution for your WordPress blog but this is only the beginning. There are so many more techniques to improve the performance of your blog. Caching is a great first step in preventing your blog from crashing during a flood of traffic.
Author Bio: Kyle Robinson Young is a freelance web programmer and designer with over a decade in the industry. He bridges the elusive link between art and code with simple and smart solutions. Visit Kyle Robinson's Website | Twitter Profile