AlgoViz

Varnish

medium 28 min

Varnish is an HTTP cache that stands in front of your web servers and answers repeated requests from memory.

Where it shows up

The same pattern appears across everyday software.

  • Wikimedia

    Wikipedia's documentation describes Varnish as the in-memory front layer of its own CDN, with rules that decide which objects are worth keeping in memory at all.

  • Verdens Gang

    The Norwegian news site that started the project in 2006 was also its first user. A news front page is the ideal case: the same for everyone, and read by many at once.

  • Fastly

    The CDN company built its platform on a heavily changed Varnish 2.1. Its edge language is still called VCL and has grown apart from the open source one.

  • Online shop

    Category and product pages are cached with tags. When a price changes, one xkey purge removes every page that shows the product. Cart and account are passed.

  • API in front of a slow system

    A catalogue API is cached for 30 seconds with a long grace. During a restart of the system behind it, readers see slightly old data.

  • Content site during a news event

    A lifetime of ten seconds on the front page turns thousands of requests a second into about one fetch every ten seconds and machine.