Categories
General

W3 Total Cache CDN broken?

As I’m sure you know, I like W3 Total Cache – it’s a fairly painless way to implement a variety of methods to speed up a site and reduce server resource usage. I especially like being able to offload media library and other files to a content delivery network like Amazon S3. Earlier today I noticed that for a particular page only some of the images were pointing at their S3-mirrored versions. Apparently I’m not the only one having this problem. In my case at least, the fix was easy: clear out the unsuccessful file transfers queue and refresh the cache.

Categories
General

S3 doesn’t like plus in filenames

Exporting my media library files to S3 with W3 Total Cache has gone mostly smoothly, with one exception – S3 replaces plus signs in filenames with the urlencoded equivalent, breaking links on the blog that still expect the plus sign in the filename.

I know what you’re thinking – “Who puts a plus in a filename??” Well, over on the family blog anything is possible! I was surprised that WP’s sanitize_file_name even allows plus signs, but it does have a convenient filter to add to the list of characters to sanitize – sanitize_file_name_chars. So, I wrote a quick plugin to add a plus sign to the list: sanitizeplus.0.1.zip

Categories
General

Trying W3 Total Cache

I’ve been trying out various WordPress caching plugins in an effort to improve page loading performance and reduce resource usage on my virtual private server. I started with WP Super Cache but quickly learned that it doesn’t work well with with DreamHost PS. Next I tried Hyper Cache and DB Cache Reloaded. While the DB Cache Reloaded description makes it sound like it does all the caching you’ll ever need, I think page caching is still a good idea to help reduce resource usage when a site gets a lot of traffic – if you can serve static pages to most visitors, your server might just survive.

I’d still be using that combination if I hadn’t found W3 Total Cache, which adds a few more features on top of page and query caching. First, it does “minification” – stripping whitespace out of your HTML, JavaScript, and CSS to make all of these smaller. Since they’re smaller, your visitors get your pages faster. Next, it integrates with Content Delivery Networks like Amazon’s S3. This means you can seamlessly host your static files like JavaScript, CSS, and images with a CDN, which can (probably) deliver them to your visitors more quickly than your web host. This also takes some load off of your server and makes it more likely you’ll survive a traffic spike. Of course, using a CDN costs something, but probably not much compared to what you’re already paying for web hosting.

I’ve been wondering how using a CDN would work with my media library – would images and files automatically get synced upon upload or would there be an annoying manual step necessary to keep things from breaking? I can report that images like this do indeed automatically get sent to the CDN upon upload:

Hibiscus

I had one small problem setting up W3 Total Cache to use my S3 account – the plugin couldn’t create a “bucket” (a folder in S3-speak). I ended up using s3cmd to create a bucket and once I entered that bucket name in the W3 Total Cache options everything worked fine.