[This post is part of the Ultimate Guide to Launching a WordPress-Powered Blog series.]
***Updated – I’ve updated all screens up to version 0.9.2.4 which was released on August 26st, 2011. Please let me know if you see anything missing!***
We just finished up going through a setup and optimization guide of WP Super Cache and now it’s time to take a look at W3 Total Cache which is another very good plugin. In fact, I trust my blogs to it every single day!
- I use it here on TentBlogger uses it!
- Human3rror, a personal blog is using it.
- All of the other blog properties that I manage which are listed here in this post.
Essentially what I do is that I move my blogs from WP Super Cache once they get to a certain point in terms of traffic and resource requirements to a much more custom and robust solution in W3 Total Cache. A few other blogs that trust W3TC with their needs:
- Mashable – Their CTO is actually the creator of W3TC! (Did you know that Mashable rated Standard Theme as one of the top premium WordPress themes out there? I use Standard Theme on this blog!)
- Smashing Magazine
- Web Designer Depot
- I Love Typography
- And thousands more seriously large blogs!
Think you’re at that point (or want to try it anyway)? Check out this overview and setup tutorial:
A Few Things to Note about W3TC:
One of the most important things that you must know about W3 Total Cache is that for you to get everything that you can possibly get out of it you’ll need some advanced server-side scripting and hosting configurations.
Thus most bloggers do not have the expertise or experience to know how to do the aforementioned things and so most people won’t find the result as beneficial as some of the other caching plugins available.
Unfortunately, as a result, W3TC gets a “bad rap” for not being a very good solution when it’s actually the limited knowledge of the end-user that’s creating the roadblock to success.
In fact, it can get worse! Without the right settings many bloggers will find their blog loading more slowly than before! This is very typical in cases on shared-hosting solutions in tandem with a “disk (basic)” and even the “disk (enhanced)” setup in W3TC as it will end up taxing the server even more in some cases. Again, this is why you’ll find a lot of bloggers crying “foul” about W3TC “blowing up” their blog as a result of a poor installation and setup.
So, what is it going to take? You see, 99% (or more) of self-hosted WordPress blogs run on an Apache + PHP-based web server configuration. I believe that to completely tweak-out a WordPress blog with W3TC you need either a NGINX + FastCGI configuration or a custom Litespeed + Op-Code in production (I personally run this setup with APC – Alternative PHP Cache). If you have no idea what I’m talking about then I think it’s only fair that one shouldn’t expect to get max and/or superior results unless they have one of those configurations or if you’re a kick butt at engineering an Apache-based environment.
This doesn’t even factor in one of the biggest contributing factors to this plugins’ success which is your blog’s hosting provider! A shared environment will always produce lower results than a virtual, semi-virtual, or dedicated system. In many circumstances you won’t be able to max this plugin out on a shared environment due to the host’s software installation and configuration constraints!
Finally, there are many other options within the plugin like using a Content Delivery Network (CDN) that further enhance the value of W3TC, even though adding a CDN is not a unique value proposition (WP Super Cache has this too). Some of these options, like a CDN, require not only additional technical ability but also money which most bloggers, especially new ones, simply can’t afford. This puts the optimal usage of W3TC even further away from the average blogger.
Of course, you could say the same thing about most of the caching plugins out there that “max” results require server-side engineering and scripting to pump out the best results!
In any case I typically recommend that most bloggers head back over to WP Super Cache as their caching plugin of choice since most server and hosting providers can natively provide an optimal return on a very simple installation.
Setting Up W3 Total Cache:
So you’re set on trying it out? Great! Here’s how to go about doing it. Of course, if you have any questions please feel free to ask me via the comments!
1. Download It
Naturally the first thing you’ll want to do is download it directly via your WordPress plugin interface or via the WordPress.org repository and then upload it via FTP:
Then, install it:
Or if you have to upload manually make sure to put it in your wp-content/plugins folder:
One you’ve uploaded it it’s time to get into setting it up!
2. Activate It
Once you activate it you may run into a number of issues right out of the gate, just like WP Super Cache. For starters you might have to chmod 777 again because of this “fatal error”:
You’ll have to change the permissions on your wp-content folder to 777 to get it installed. To do that just jump into your FTP app and change the permissions or use your hosting provider’s web-based interface:
Here’s what it might look like in a web-based interface:
After you change the settings you should be good to go – go ahead and try activating it again.
You should just see this:
Great! Next step…
3. Customizing the Setup
The next step is to head over to the management section of the plugin itself and begin to turn things on and off for your blog.
This will be the largest portion of your time spent and you may want to dedicate some time to configuring this plugin (and understanding it) before actually deploying it.
The menu item will be near the bottom of your WordPress dashboard on the left:
Go ahead and hit General Settings to get started. You might see some warnings at the top like these:
One of them will mention how your wp-content folder is “writeable” and needs to be chmod’d back to 755. That’s easy enough. The second will mention how you’re in “Preview Mode” and none of your settings or changes will become active until you either “Deploy” the system or disable the preview mode. Good enough as you won’t want to deploy anything quite yet!
Some of you might see some .htaccess issues with the same permission challenges:
You’ll have to chmod either your parent directly or the .htaccess file directly. Go ahead and try clicking the “try again” button and see if it clears after you’ve made the right adjustments.
The first section you’ll see is General Settings and here you’ll be able to turn on and off the many features of W3TC.
I’ve already covered page caching in this post here so go ahead and read some of the obvious benefits of using this option.
This simply makes those “dynamic” pages more “static” so that your site loads faster as it doesn’t require the user to request information from the database again and again.
For most people on shared blog hosting solutions you won’t have many options other than “Disk (basic)” and “Disk (advanced)” as seen below:
At this point if this is all you see then I immediately recommend most bloggers to un-install this plugin and go install and use WP Super Cache instead since you won’t see very much difference between the two as a result.
I firmly believe that the value of this plugin lies in your ability to choose the specific Opcode features that match the custom configurations of your server. If you do not have APC, eAccelerator, XCache, or Memcached as options this plugin won’t really provide the “punch” that you were looking for.
Some would argue otherwise but I generally suggest that you can stop here and safely use WP Super Cache as a healthy alternative.
For those interested in continuing I have found great results with both Memcache and APC and have experimented heavily with both:
If I were to choose one I’d say that APC is far and away better than Memcache but that’s only because I’m using a heavily customized non-Apache-based system and instead opted for Litespeed which is an additional IT cost.
If you head deeper into the settings you’ll find more specific options. Here’s what I have:
And then at the end I’ve preloaded the system using my XML sitemap:
A few of you might have the technical chops to add a Varnish system to your server and if you do then awesome! Just make sure that you get rid of cookies via your system since there won’t be any point of having Varnish with cookies enabled.
What’s been proven a couple of times though is that Apache + Varnish caching is actually slower than a simple Litespeed caching solution. Thus, I don’t actually need Varnish. Some have eeked out some crazy results with heavy customization with NGINX + Varnish less the database caching options but now you might simply be confused.
Finally, I use the default settings from for the Purge Policy:
Alright? Let’s jump in farther!
Note, the above screenshot was the older view. New screenshot below with updated notes:
Essentially what “minifying” does to the files on your site is combine them into one file and then strip out all the unnecessary code that increases the weight of the overall file.
You should do your research on each HTML/JS/CSS minifier and find out which one works the best considering your unique hosting setup.
Again, I’m personally using Opcode: Alternative PHP Cache (APC) in my configurations and if all you have is “Disk” option available then I’d probably consider using another plugin.
Of course, it’s up to you!
If you jump into some of the advanced settings you’ll find a bit more options for your minified files. Here is a look at my settings:
Make sure that you test what your end-users see so as to not miss out on an error!
Below is the “old” version of this screen so if you have an older version you’ll see this:
I like getting both admin and email notifications if something breaks.
I have found that minifying the feeds can cause instabilities for some RSS readers so I choose not to minify them.
I’ve opted not to do line break removals since the variety of my JS calls.
This screen below is an older version of the plugin’s look:
You can choose to combine only after a certain area on your theme’s code but typically you’ll want to capture all of them so just leave those un-checked.
I do, in fact, combine my CSS into one file via the CDN.
This is an older screen for those still using older versions.
By enabling all these you streamline your CSS files to the max! This always looks so neat.
Please note that minification is one of the areas that you may spend a lot of time on because, depending on your setup, you might have to play around with some of the files and settings to get your blog to show properly.
There are some features and scripts that simply do not function as they were intended in a minified-state. Also, your WordPress Theme will interpret some of these requests in different ways so you might end up with a fully functional look with one theme while another one might completely break in style and form.
Of course, don’t forget the nice Help Wizard that’s available to you to find those files (although it’s not always comprehensive, so you may have to add files manually):
This will give you an overlay screen to choose the right files to minify:
Then save and then refresh the cache and you should be set.
Database and Object Cache
Both the Database Cache settings and Object Cache settings (above and below) are pretty straight-forward. Both of them essentially speed up the creation and distribution of data to and from your blog to your readers.
You can simply enable both of these and then use the default settings for both:
That should be good enough.
Browser Cache Settings
I talked already about the basics of browser caching so you should already been aware of the benefits. Enable this and then head over into the advanced settings.
I pretty much have all of the settings checked:
That should do it.
Content Delivery Network
Make sure you choose the right “pull” or “push” depending on the CDN system that you’re using.
Head over to the advanced tab to customize it further as well as to add your selected CDN config:
You’ll notice that I don’t have the last box checked and that’s because I try my best to never use a piece of content (images especially) that is not directly hosted and/or saved onto my own domain. This is to provide the most consistent and sustainable user experience!
If you need to you can import the attachments and files by using the buttons above but after that I’d refrain from adding more!
Finally, the actual settings for your CDN should be inputed:
As you can see I’m using cdn.tentblogger.com as my hostname. There are some things that you’ll have to do on your web hosting provider to enable this feature (like creating a new CNAME record in your DNS) but that shouldn’t be too hard to figure out, right?
Great! You’ve pretty much tweaked and modified your W3TC settings for optimal usage! All you have to do now is turn the system on by heading back to the General Settings tab and choosing the top option!
Of course the next things you need to immediately do is test it on different browsers to see if it’s actually working.
If it is then you should see a considerable increase of speed as well as a little notice on the bottom of your pages like this when you do “View Source”:
A Few Final Options
Finally there are a few options and features in this robust plugin that’s worth noting, the first being the Debug mode that can help you figure out what’s broken or what’s not working:
If you have an older version you might see this:
This system works really well but you’ll typically want to do any debugging on a low traffic day or in the beginning stages of a new blog so that user experience isn’t being impacted.
The second is some Miscellaneous settings that I typically don’t activate, especially the “Enable file locking” option:
The new Google Page Speed widget for the front dash of your blog is neat. I’ve enabled it. Here’s what it looks like in the dashboard:
And then if you see “View All Results” you can see a breakdown of what’s really going on:
Getting an API is quite easy. Just go here and click this box:
Then copy and paste the Simple Key that they give you:
If you have an older version you’ll just see this lame looking miscellaneous widget:
Finally, one of the most useful features is the ability to import and export your settings for other installations and backup. Since I have more than one blog using this heavily customized set of settings it makes it super easy to duplicate my work by exporting a “core” setting and then importing this file into new blogs:
Whew! And with that we’re about done. This 3,000 word post should help give you at least an idea of what this plugin can not only do but some of the many options available to you.
I’d love to hear from you though! What is your current setup? What’s your server configuration? What have you found that does and does not work? What do you think can be improved?
And of course if you have any questions just shoot them in the comments!
[This post is part of the Ultimate Guide to Launching a WordPress-Powered Blog series.]