Almost without fail I add caching to all the sites I deal with for customers (and myself) at the end of the project. And for the longest time the procedure was always the same thing: add WP-SuperCache, enable it, and do just a slight bit of tweaking to get it all nice and streamlined.
WP-SuperCache doesn’t seem to make THAT much difference under a light load – however, when you have a site that’s being banged on by 50,000 visitors in a month (yes, one of the sites I deal with does that much traffic) WP-SuperCache saves your butt. And I’m one of those once I find something that works very well, I tend to stick with it for quite a while – unless I find a good excuse to go out and test new stuff. (And I will admit that quite often I make up my own excuses to try out new tech – often the excuse is “I need to explore it so I can explain it to my customer base.”)
I found an excuse to re-think all of my setups for WordPress. For some reason the server started taking a really hard beating, and was frequently falling over dead from lack of memory. After doubling the amount memory available it would still fall over in the middle of the night according to my monitoring system.
I started doing some digging, and I won’t get into the unimportant parts, but WordPress 3.2.1 seems to be using a bit more memory than previous versions. So I started looking at my other options – my first stop was the excellent W3 Total Cache. I had read some good comments on it, but I had also seen a few negative reviews of it – so I gave it a shot.
Right off the bat I could see a reduction in load times – nothing spectacular, and the server wasn’t using any less memory than it was before, unfortunately. Since my problem was running out of memory, not CPU utilization, I turned off a few things like gzip compression, trying to find a balance between speedup and memory usage – turning off gzip saves a bit during the caching process.
Next I wanted to try out something: Cloud Flare. Cloud Flare is a Content Delivery Network (CDN, for those who’ve seen the TLA but wondered what it meant), and unlike Amazon S3 and a number of others, it’s free. Well, OK, it’s a “freemium” service – it’s core is free, but there’s a number of add ons you can put into it, plus they appear to make money from advertising other services that are in-line with the Cloud Flare network. Cloud Flare has it’s own WordPress plugin, but W3 Total Cache also has provisions for it built in – just fill in your account information.
Now, Cloud Flare does slightly go against my “everything under my control” policies – you have to make a few changes to your DNS settings that point at Cloud Flare, moving requests through their network first. HRM. The downside would be those moments when Cloud Flare has a network failure, you’re SOL. Every layer between you and your content is yet another thing that can break. On the other hand, CDN’s are distributed networks with fewer single points of failure than your standard host.
I tweaked the standard Cloud Flare setup just a bit, but when I was finally happy with performance I was flat out impressed. Using a fresh browser (FireFox, which I hadn’t used for my testing so it had nothing already cached locally) the front page took 3 seconds to load. Not bad at all, considering the front page used to take about 8 seconds to get fully loaded. Any other page after that took less than a second, and a few loaded about as close to instantly as you can get without having a pre-load caching system going (Cloud Flare offers preload caching if you go Pro with it – I didn’t, so there was no pre-load involved.) Same went for Safari, Chrome, though I haven’t tested IE yet.
For mobile platforms, performance improvement was great too – an iPhone 3GS on AT&T with three bars of service took 7 seconds to load the initial page (meh), and 3 seconds for each addition page (not bad!)
Overall, I can’t say enough good things about the W3 Total Cache + Cloud Flare combination – at the moment. As with many things there’s a lot of variables involved – your server configuration, for instance might not like W3 Total Cache that well, requiring more tweaking to find optimal results. And I need to wait and see if the Cloud Flare network has problems or not. So far it’s all been good!
if you’re curious, and end up using Cloud Flare, here’s the configuration settings I’m using across four domains at the moment:
- Security: Medium
- Caching Level: Agressive
- Rocket Loader: Automatic (it’s a beta feature)
- Track Outbound Links: On
- Hotlink Protection: On
- Google Analytics is turned on (and I turned off the WordPress plugin I was using for it)
The rest of it is set for defaults.
At some point I’ll probably throw up an update on it as one of the sites – the Great Plains Ren Fest – hits around 50,000 visitors a month when the next faire rolls around (in October). It should be interesting to see what sort of results it gets under that load!
Oddly enough… my server still seems to be having some memory issues. It’s using more than it should, IMO – but it’s no longer falling over and dying in the middle of the night, so the reduction in load is a win 🙂
1 thought on “Improving WordPress Performance With W3 Total Cache & Cloud Flare”
good article. i think i will try Cloudflare as well.