How to Optimize WordPress, Part 2
My last post on how to optimize WordPress covered some general optimization techniques to speed up a website. Reducing HTTP requests, removing wasteful plugins and decreasing file sizes helped quite a bit. Now it’s time to try out page caching.
If you remember, the five things that normally occur for each page are:
- Initialize PHP
- Query the database
- Create the page
- Send the page
- Send additional files
Page caching plugins, like Hyper Cache and W3 Total Cache, eliminate steps two and three, except when creating a page the first time. WP Super Cache also cuts out step one.
All of the plugins were fairly easy to install. And I discovered during my tests that WP Super Cache, at least at Nearly Free Speech.NET, works just fine with safe mode on.
This graph shows the time it took to load my home page with each of the caching plugins enabled. I have circled the point where I first turned on page caching.
Hyper Cache and WP Super Cache both performed well. W3 Total Cache seemed to struggle. It does more than page caching, like reformatting files to save space, but clearly slowed things down.
WP Super Cache has a few advantages over Hyper Cache:
- It supports browser caching better
- It doesn’t need to load PHP
- It checks for security problems and suggests fixes
So I am now a happy WP Super Cache user.
UPDATE Dec 2009:
After a few days, I started having issues with WP Super Cache and switched back to Hyper Cache. You can see how the irregularities went away. I’ve been using Hyper Cache for almost a week now, and things have remained stable.
After being contacted by the author of the W3 Total Cache plugin, I’ve agreed to give it another try. I turned off all the settings except for “disk enhanced” page caching. I’ll update the article again in a few days.
UPDATE Jan 2010:
After looking into things a bit more, my results are still showing Hyper Cache to be faster than W3 Total Cache. However, when I test using the curl command line tool from home, it seems that both plugins are about the same speed. My web hosting company uses a network-level reverse proxy and a few other caching tricks that eliminate the need for some of the features provided by these types of plugins. I’m not sure what’s going on here, but will be sticking with Hyper Cache for now since it appears to work better with my particular situation.
I do like that W3 Total Cache handles page compression properly. I could not get page compression to work with Hyper Cache and had to turn it off. I’d recommend you try all three plugins and measure which works best for you.
UPDATE Apr 2010:
I’ve been having some troubles with Hyper Cache recently. Page redirects were working properly in Firefox, but not in Safari. I tried a new caching plugin I hadn’t heard of before: Quick Cache. Redirects are now working in both browsers. After a week of using Quick Cache, it’s performance is very good. I’ve decided to stick with it.
WordPress After 8 Months
Early this year, I switched from Movable Type to WordPress for my blog. I’ve been very happy with that decision. So I thought I’d give an update on how I feel after using WordPress for eight months.
First, I should say that the speed issue hasn’t bothered me like I thought it would. I haven’t added caching, but may still do so at some point. Let me know if things feel slow.
Second, I’ve changed the which plugins I use, so let me give you the current list.
- NEW — Twitter Friendly Links let’s me use my own domain for short URLs instead of Bit.ly or TinyURL.com
- NEW — RF Twitter Post will update Twitter when I write a new post. I’m testing this one and hoping the next version adds support for Twitter Friendly Links
- NEW — SexyBookmarks makes it easy for readers to share things they find interesting
- Aksimet filters comments from spammers of which there are many
- All in One Adsense and YPN handles the ads on my site though I have them turned off now
- FD Feedburner Plugin lets me use FeedBurner for my RSS feeds
- Google Analyticator adds the Google Analytics tracking code
- KB Robots.txt allows me to add my sitemap to my robots.txt file
- Markdown allows me to write using Markdown syntax
- Recently Popular highlights what posts people find interesting
- Simple Google Sitemap automatically creates a sitemap for me
- Twitter lets you know exactly what I’m up to at all times
- WP-DB-Backup makes it easy to back up the content on my site
- Yet Another Related Posts Plugin suggests additional posts that relate to the one you’re reading
Since January, I’ve stopped using Automatic Timezone because putting WordPress 2.8 and PHP 5 together makes the daylight savings time magic work.
Third, I was able to find several WordPress themes that I liked and get them installed fairly easily. And switching between them is simple.
Overall, I’m still very happy.
2009-12-05: I spent some time optimizing WordPress which you can read about here.