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.
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.
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.
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.
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.
The web management administration interface
If you're managing a whole cluster of varnish servers you might find the Varnish Administration Console useful. It is only available for customers with a Varnish Enterprise Subscription.
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. .
Rewriting and redirecting URLs
Varnish can both rewrite and redirect URLs without any external programs.
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 Varnishlog for an explanation of what the tags means.
varnishhist will give you a rather intuitive histogram of what the typical response times are.
varnishstat will give you a lot of statistics.