Varnish Cache - Memory, Hitrate & Bandwidth Optimisation for Drupal Pressflow

Submitted by Janak on Tue, 01/11/2011 - 16:39

Recently I started to notice I very high number of LRU Nuked Objects on my websites, which was essentially wipping the entire Varnish Cache. I run Varnish with 4GB File cache and site ocntent is mostly served by external "Poor Man CDN". So, in theory my site content should not be anything near 4GB, however, Varnish Cache was running out of memory and "Nuking" cached objects.

Sizing your cache

Here is what Varnish Cache man pages have to say:

Watch the n_lru_nuked counter with varnishstat or some other tool. If you have a lot of LRU activity then your cache is evicting objects due to space constraints and you should consider increasing the size of the cache.

Varnish Cookie Tweak to allow Anonymous Comments with Pressflow

Submitted by Janak on Wed, 12/29/2010 - 13:28

If you are using Drupal and have allowed anonymous user to leave comments on the site, you will notice that the core comments module adds two cookies named comment_info_name and comment_info_mail. These cookies allow the comments form to be auto populated with name and email on any subsequent comments from the same user.

For majority of users this is not something of a concern. Whist this is useful, if any cookies are passed back from client side in the request, Varnish will simply request the page from the back end instead of requesting the page from the cache. This will result in many cache MISSes as the cookie is set for 365 days (!!!!)

Varnish and Pressflow (Drupal) - Improve HIT rate and SEO - 301 redirects using Varnish

Submitted by Janak on Mon, 10/04/2010 - 18:52

Following on from previous post about VCL tweaks to improve hitrate; there are occasions when a website should not be served from both and In some instances Google will deem the content to be duplicate copy of each other and a website can suffer from dupe content penalty.

Varnish and Pressflow (Drupal) - VCL tweaks for achieving a high hitrate

Submitted by Janak on Thu, 09/30/2010 - 11:58

The default Varnish config for Pressflow by Four Kitchens is an excellent starting point and gets you up and running with relatively little pain and effort. Having done a fair amount of Varnish tweaking for my personal and work websites, I came across a couple of varnish tweaks that resulted in a phenominal improvement in Varnish Hit rate.

Vary User Agent

Install Pressflow (Drupal), Varnish, APC and Apache on CentOS 5.5

Submitted by Janak on Sat, 09/25/2010 - 13:50

After having run website on Drupal 6 with Apache+PHP+MySql, I wanted to move to Pressflow so I could harness the added advantages of Varnish.

This is not an in-depth installation guide or a discussion about Varnish or Pressflow, but quick setup commands for my own reference. Please see links at the end if you wish to explore Varnish or Pressflow setup in greater depth.