My server doesn’t hate me anymore thanks to W3 Total Cache
Updated
Viewing page 2 of 3
W3 Total Cache installs a humongeous “Performance” menu. I’m going to walk my way through the menus and settings, letting you know what I set and what I learned.
General Settings
First off, W3TC includes a preview mode which is a very nice addition. Some (many) of these options have the capability of borking your site, so enable preview mode and get used to this workflow: save all settings->preview->deploy
I’d suggest not checking the box to turn everything on right away. Instead, go through the options one by one turning them on, saving, previewing, deploying. That way if something on your site breaks, you know what you did to break it.
For all of my cache methods, I’m using Opcode: XCache and I’ve enabled just about all of the sections available. The plugin folks recommend using an opcode cache to keep things ready and in memory. XCache happens to be enabled easily with DreamHost VPS, so that’s what I went with.
The plugin warns, in the Install tab, against using Disk Caching for Database and Object caching because it may be too slow.
I haven’t investigated Varnish, so I’m not using that.
At this time, I prefer to keep my DNS hosted at DreamHost, so I’m not using CloudFlare.
Page Cache tab
Cache everything! Mostly… I do not cache my 404 page because it warns about a 200 status code being returned. Which would be incorrect and I don’t cache for logged in users. I believe I’ve left the other settings at default
Minify tab
I’d recommend working slowly through this tab. For instance, on this site, I’ve already done some minification of my javascript and I needed it to be included in a specific order. W3TC destroyed that order and broke my site. As such, I’ve left minification of Javascript off, but opted to minify HTML and CSS. YMMV
Database Cache tab & Object Cache tab
Default settings were fine for me.
Browser Cache tab
In this tab, I’ve turned on just every checkbox except the “Prevent caching of objects after settings change.” Which I may turn on as well… If you have a lot of repeat visitors, this tab will be important to optimize well.
User Agent Groups tab and Referrer Groups tab
These two tabs allow you to filter incoming requests by either user agent (browser & computer) and/or referrer (such as Google or Facebook) and then feed them a different WordPress theme. It happens to be a very convenient way to build a mobile-specific version of your website.
CDN tab
A Content Delivery Network allows you to host static elements on a different server that’s optimized to server static elements. This does a few things:
- Allows for browser pipelining. When your browser requests your page it can only open so many concurrent connections (requests) for various elements from your domain. But there’s nothing stopping it from opening a second set of concurrent connections from a different domain (i.e. your CDN)
- The CDN is lean and mean. A proper CDN is set up without the capability of serving PHP files. It’s lean and mean and optimized to serve static content.
- It may be distributed
A really awesome CDN will have your files in different places around the world country or world so that when someone in New York requests some files they get there as quick as someone requesting them from Australia
W3TC has built-in support for a whole mess of CDNs including the ability to host your own. However, I used Amazon S3 and have determined that it’s super easy to set-up. Note that a CDN is not free, but the cost should be very low in comparison to your webhost’s cost for increasing your VPS’s memory.
That will get the CDN set-up, now we need to prime it with content. I selected to have it host my attachments, include files, theme files, and custom files, so mark those checkboxes.
- If you’ve had your site running for a while, or you’re a fan of hotlinking to images, you may want to click the “importing attachments into the Media Library” button. This will make sure all your attachments are in the WordPress media library and it will update your URLs as needed. Because of this you may want to backup your database first
- At this point, you can use the various upload buttons to upload all your files to the CDN
- Test! I had an issue with a few files that weren’t uploaded to the CDN the first time around and were generating 404 errors. I didn’t immediately notice the problem because they were font files, but a 404 error can slow down my site. Using the “Theme file types to upload” box I was able to fix this issue. So, test to make sure all your files are being served a) from the CDN and b) aren’t producing 404 errors.
Install tab
There are some recommended rewrite rules to include in various .htaccess files. I believe the plugin will try to include this automatically, but if it doesn’t, be sure to put it in there manually.
So, what did all this work do for me? See the results
There are no comments at this time. Sad.