Cache Your WordPress Blog

(Originally published on RefreshCleveland)

The power of microsoft
Creative Commons License photo credit: doyoukekko

In the past few weeks, I’ve helped some of my friends move their WordPress blogs to new servers. One of them had a consistent problem with their host because WordPress was hogging cycles on the shared server. We implemented the WP-Cache plugin, and things got better in minutes.


Jeff Atwood has written a terrific article about the perils of using WordPress without caching.

I’ve been thoroughly impressed with the community around WordPress, and the software itself is remarkably polished. That’s not to say that I haven’t run into a few egregious bugs in the 2.5 release, but on the whole, the experience has been good bordering on pleasant.



Or at least it was, until I noticed how much CPU time the PHP FastCGI process was using for modest little old blog.stackoverflow.com.

Read the full article if you have Wordpress blog — even if you’re not technically inclined. You’ll thank yourself later.

Caching is the smart way to handle any generated content. When you cache your content, a plugin or service will take the HTML generated by your blog and save it to a flat file. It’s just like taking a snapshot. The cached file will expire after a time, so that your content will remain fresh. It takes many less CPU cycles to serve flat file than to generate them from the database every time. This has the added benefit of speeding up your blog’s display time as well.

Consider your RSS feeds. While RSS is a great thing, every time someone hits your feed you are generating content from the database and serving it out to the world. Poorly behaved RSS readers will this your feed as often as every five minutes. For a worst case scenario, take the file size of your feed when generated, multiply it by the number of subscribers you have, and multiply that by 12. That’s how much bandwidth you could be using per hour for the feed alone. If you have a great number of items in your feed or are very popular you’ll eventually get a shutdown notice from your host or the site will simply shut down on it’s own, displaying a lovely error message to your audience.

To avoid downtime, use WP-Cache or WP-SuperCache to implement a quick caching solution. For an additional layer of protection, try using Feedburner for your feeds. It caches your feed for 30 minutes on their server, so you reduce the load on your server considerably. You’ll see your blog begin to behave, and you’ll get those creepy hosting admins off your case.

Advanced Users: For those of you who have full control of your servers, look at using memcached to handle the caching for the server. Less wear and tear on the disk, performs better for larger-scale projects than simple file caching. Check out Ryan’s post on how to implement WordPress with memcached.

Tags: , , , ,

Leave a Reply