Whys and Why-nots of Varnish-Caching WordPress

After Installing the default server and getting it trouble free and upgraded, its time to set things up as they are meant to be. And unless you have a very dynamic site, you should try Varnish Cache. Its far faster than others, because it sits on the front of the server and serves cache instantly as far as possible. For all intents and purposes, your blog runs like you are serving static html. Static. Get it? Which means there are drawbacks, so please consider the following carefully.

WordPress is a cookie monster. Cookies defy cache. While still useful, you’ll likely end up under utilizing the cache so much that its pointless. After all, the gains must weigh against the extra layer, and thus extra opportunity for something to go wrong, particularly with something with as much potential for disaster as a cache. Essentially, what we will be doing is moving Apache (which serves our wordpress) to a different port, and the Varnish cache takes its place instead.

Good bits. Fast. Regardless of whether you are enduring a “digg” (isn’t that Twitter these days?) or you are trying to reduce the load on the server in general, there is nothing like an instantly loading site to keep visitors happy and returning.

Bad parts. Things that depend on cookies are best removed for performance. Not as simple as you think. Commenting becomes a pain, you may be logged in, but the “edit” link for articles vanishes… etc. There are ways to manage this, but they are more complicated. What I’m using here is efficient, quick and painless, which is how I like things to be.

I prefer using a commenting service which dishes out the comments with javascript. For all intents and purposes, you could add comments to static pages….. which is what we want. As you see, I use Disqus.

Leave a Reply

Your email address will not be published. Required fields are marked *