Varnish is an HTTP accelerator designed for content-heavy dynamic web sites. In contrast to other HTTP accelerators, such as Squid, which began life as a client-side cache, or Apache, which is primarily an origin server, Varnish was designed from the ground up as an HTTP accelerator.

Varnish stores data in virtual memory and leaves the task of deciding what is stored in memory and what gets paged out to disk to the operating system. This helps avoid the situation where the operating system starts caching data while they are moved to disk by the application.

Furthermore, Varnish is heavily threaded, with each client connection being handled by a separate worker thread. When the configured limit on the number of active worker threads is reached, incoming connections are placed in an overflow queue; only when this queue reaches its configured limit will incoming connections be rejected.

The principal configuration mechanism is VCL (Varnish Configuration Language), a domain-specific language (DSL) used to write hooks which are called at critical points in the handling of each request. Most policy decisions are left to VCL code, making Varnish far more configurable and adaptable than most other HTTP accelerators. When a VCL script is loaded, it is translated to C, compiled to a shared object by the system compiler, and linked directly into the accelerator.

A number of run-time parameters control things such as the maximum and minimum number of worker threads, various timeouts etc. A command-line management interface allows these parameters to be modified, and new VCL scripts to be compiled, loaded and activated, without restarting the accelerator.

In order to reduce the number of system calls in the fast path to a minimum, log data is stored in shared memory, and the task of filtering, formatting and writing log data to disk is delegated to a separate application.

External Links

TomTom Office in Amsterdam

TomTom Office in Amsterdam

VUG3 – Varnish User Group Meeting 3

  • When: Monday 14 February 2011 and Tuesday 15 February 2011
  • VUG sneak-preview gathering on Sunday 13 February 2011 for those coming to Amsterdam before Monday
  • Location: TomTom Office @ Rembrandtplein 35, 1017 CT Amsterdam, The Netherlands
  • Who: Varnish Cache Users (Developers + Administrators)
  • more details on VUG3 (

Well, I was there and had two very informative and interesting days with other varnish users from all over the world. Although the focus was still quite strong on the developer side, we had some great insights on what varnish will be with the upcoming release 3.0. Only thing to tell is: Stay tuned! Great things to come 🙂