
Varnish
Profile
Varnish is an open-source HTTP reverse proxy and caching accelerator designed to dramatically improve web performance by storing frequently accessed content in memory and serving cache hits with extremely low overhead. Originally created in 2005 by Norwegian newspaper Verdens Gang to handle massive traffic loads, Varnish has evolved into a mature, mission-critical infrastructure component deployed across millions of websites worldwide, including major platforms like Facebook and Wikipedia. Licensed under the permissive two-clause BSD license, Varnish can yield order-of-magnitude performance improvements and materially reduce origin load, depending on cacheability and configuration.
Focus
Varnish addresses the fundamental gap between exponential user demand growth and limited backend application server capacity. By intercepting HTTP requests as a reverse proxy and maintaining a high-speed in-memory cache, Varnish serves pre-generated responses directly to clients without backend involvement, dramatically reducing server load, and enabling single backend servers to handle thousands of concurrent users. Platform engineers and infrastructure teams deploy Varnish for web acceleration, API caching, video streaming delivery, and private content delivery networks. Organizations achieve cache hit rates exceeding 90 percent, allowing backend servers to handle only 5-10 percent of total traffic while maintaining sub-30-millisecond response times.
Background
Varnish was conceived by system administrator Anders Berg at Norwegian newspaper Verdens Gang in 2005 to address exponential traffic growth reaching 45 million weekly page views. Danish computer scientist Poul-Henning Kamp led the architectural design, emphasizing working with operating systems rather than against them and solving real-world problems over theoretical perfection. The project was open-sourced in 2006, enabling widespread adoption across online publishing, e-commerce, and technology sectors. Varnish Software, founded in 2010 and currently owned by Swedish investment firm Neqst, provides commercial enterprise offerings while the open-source project maintains independent governance. The project remains actively maintained with regular releases and continues serving as critical infrastructure for major internet platforms.
Main features
Domain-specific configuration language for request handling
Varnish Configuration Language (VCL) provides a C-like domain-specific language enabling administrators to define precisely how requests should be handled at each stage of the request-response cycle. VCL code is transpiled to C during loading, compiled to a shared object by the system compiler, and loaded directly into the running Varnish process without requiring restarts. This architecture delivers exceptional speed compared to interpreted configuration languages while enabling sophisticated policies including request routing to different backends, header manipulation, load balancing with health monitoring, cache control fine-tuning, Edge-Side Includes for partial page caching, authentication implementation, and cache invalidation strategies based on application events.
High-performance threading and memory architecture
Varnish assigns each client connection to a dedicated worker thread, maximizing performance by allowing independent operation without contention and fully utilizing multi-core processors. Rather than manually managing memory-to-disk paging, Varnish stores data in virtual memory and delegates paging decisions to the operating system, leveraging decades of OS optimization while avoiding thrashing scenarios. Shared memory logging minimizes system calls in the critical fast path by accumulating log data in shared memory with separate applications handling formatting and persistence. This architectural approach enables Varnish to achieve microsecond response times and throughput measured in terabits per second under extreme load conditions.
Grace mode and resilience mechanisms
Grace mode enables Varnish to continue serving expired cached content when backend servers are temporarily slow or unreachable, maintaining availability during backend problems without impacting users. When cached objects expire, Varnish normally fetches fresh versions from backends, but grace mode allows serving stale content while asynchronously revalidating, with independently configurable grace periods typically set to reasonable durations like 300 seconds. Combined with saint mode, which excludes backends returning error responses from the available pool for configurable quarantine periods, Varnish maintains service availability even during significant backend failures, enabling organizations to achieve high availability without complex failover infrastructure.


