Varnish features explained

Design

One of the main features of Varnish is its design. Varnish is a modern program, designed and written for modern operating systems. To read more about the thoughts that lie behind the design see the architect notes.

VCL

Another main feature of Varnish is its configuration language. VCL is a  domain specific language. Varnish compiles the configuration into binary code and runs it. VCL can be loaded and replaced on the fly.

All this adds a lot of speed and flexibility. To read more about the VCL start out with the main VCL page and the VCL examples.

A sub-feature of VCL - inline C

Varnish allows you to add C code in your VCL - giving you the option to easily expand Varnish on the fly. See this document for an explanation. For examples you can check out Geo IP using inline C or Syslog support in inline C.

Load balancing and backend health polling

As it's quite common to use more than one origin server to feed varnish, it has a built in load balancer. This consists of two parts:

  • The health polling system, which maintains a list of backends able to receive traffic.
  • The director, which directs the request to the right backend.

Read more about it on the load balancing page.

Edge Side Includes - ESI

ESI allows you to split up your web page into components cache them individually. If you're going to use Varnish to accelerate a dynamic web site with a lot of personalized content ESI is the key to success, more or less. Read more about it here.

Graceful handling of dead and slow backends

Varnish can serve old content while the origin server generates new content. Work is underway to ensure that Varnish can also keep serving content if the origin server is crashed. Please see Grace? for details.

The web management user interface

If you're managing a whole cluster of varnish servers you might find the Web GUI useful. This is only a technology preview and should not yet be used in production. Expect this to be finalized in the Varnish 2.1 release which will be released sometime in 2009 Q2.

The management port

A running Varnish cache can be managed with a management port. You can just telnet in and upload a new configuration, change settings, etc. See Management port for a general description on how this works.

Rewriting and redirecting URLs

Varnish can both rewrite and redirect URLs without any external programs. See redirects and rewrites for details on how to do that.

Live statistics and logging

For performance reasons varnish logs to a shared memory segment. Several tools can be used to inspect and analyze the logs. varnishlog gives you a dump of the raw logs - see Varnishlog for an explanation of what the tags means. varnishhist will give you a rather intuitive histogram of what the typical response times are and varnishstat will give you a lot of statistics. A page describing what the different stats mean can be found here.