This module provides integration between your Drupal site and the Varnish HTTP Accelerator, an advanced and very fast reverse-proxy system. Basically, Varnish handles serving static files and anonymous page-views for your site much faster and at higher volumes than Apache, in the neighborhood of 3000 requests per second.

This module provides admin-socket integration which allows Drupal to dynamically invalidate cache entries, and also lets you query the Varnish admin interface for status, etc.


At the moment, using Varnish to any effect at all requires Drupal 7 or PressFlow.

We currently support Varnish 2.0, 2.1 and 3.

Helpful information for those new to Varnish:

Also, this module is beginning to implement dynamic cache expiration via the expire module, which will allow for much longer page lifetimes (and thus higher cache hitrates!).

Drupal 7 version

A development release for Drupal 7 has just been released. This version is very similar to the D6 version, the only major difference is that the D7 version uses a cache backend plugin that can be used for cache_page instead of the built in database cache. In order to get the Varnish module working for D7, you need to add something like this to your settings.php file:

// Add Varnish as the page cache handler.
$conf['cache_backends'] = array('sites/all/modules/varnish/');
// Drupal 7 does not cache pages when we invoke hooks during bootstrap. This needs
// to be disabled.
$conf['page_cache_invoke_hooks'] = FALSE;

If you plan to use the expire module to be selective with your cache clearing you should add as a new cache bin for varnish so you can purge if needed but pages will not be cleared on normal operations.

['cache_class_external_varnish_page'] = 'VarnishCache';                                                              

If you are not going to use the expire module you should replace the default page cache with varnish.

['cache_class_cache_page'] = 'VarnishCache';  

This release needs some love in form of testing and bug reports. Please report anything you find, so we can get a stable release out as fast as possible! =)


"Varnish" is a registered trademark used with permission from Varnish Software.

Project Information