Varnish Cache
Varnish Cache is an open-source HTTP accelerator (reverse-proxy cache) designed to dramatically speed up content-heavy websites by storing responses in memory.
Definition
Varnish Cache is an open-source HTTP accelerator (reverse-proxy cache) designed to dramatically speed up content-heavy websites by storing responses in memory.
Overview
Varnish, created by Poul-Henning Kamp, sits in front of web application servers as a reverse proxy and caches HTTP responses in RAM, so repeated requests for the same content can be served without hitting the backend application or database at all. Because cache lookups happen in memory rather than on disk, Varnish can serve extremely high volumes of traffic with very low latency for cacheable content. Caching behavior is controlled through VCL (Varnish Configuration Language), a domain-specific language that lets operators write custom logic for what to cache, for how long, how to vary cache entries by request headers or cookies, and how to handle cache misses or purges. This gives fine-grained control that goes beyond simple time-to-live caching, including support for edge-side includes and cache invalidation on content updates. Varnish is commonly deployed in front of content management systems, e-commerce platforms, and high-traffic news or media sites where a large share of requests are for content that changes infrequently, complementing (rather than replacing) load balancers like HAProxy or Nginx that may sit alongside it in the request path.
Key Features
- In-memory HTTP response caching for very low-latency delivery of cacheable content
- VCL (Varnish Configuration Language) for custom, fine-grained caching logic
- Cache invalidation and purging support for content that changes
- Support for edge-side includes to cache partial page fragments
- High throughput designed for content-heavy, high-traffic websites
- Works alongside, rather than replacing, backend load balancers and web servers
Use Cases
Frequently Asked Questions
From the Blog
How to cache dependencies in CI without breaking builds
Speed up pipelines safely: designing cache keys from lockfile hashes, choosing what to cache, restore-key fallbacks and spotting a poisoned cache.
Read More Cloud & CybersecurityDesigning a caching layer and avoiding cache stampedes
Add a cache without adding an outage: choosing what to cache, invalidation strategies, TTL jitter, single-flight rebuilds and handling cold starts safely.
Read More AI & TechnologyThe KV cache explained: why it dominates LLM memory during serving
The KV cache makes generation fast and memory-bound at once. Learn what it stores, why it caps concurrency, and the levers that shrink it without hurting quality.
Read More Data ScienceHow to build a tf.data pipeline that stops starving your GPU
Low GPU utilisation usually means the input pipeline cannot keep up. Confirm it by timing the pipeline alone, then order the operations correctly — map, cache, shuffle, batch, prefetch — and parallelise the expensive stages. Ordering affects correctness as well as throughput.
Read More