Varnish Cache is a reverse web proxy caching system. This system’s main objective is to act as an operator or a virtual security guard. It will act as an operator by intercepting every single web request prior to them reaching your web server or Apache. Varnish is a web accelerator that is written with flexibility and performance in mind. Its modern day architecture allows it to produce higher performance than other competing systems.
Varnish’s Main Objective
The main objective behind Varnish is serve pages fast in order to give a website a significant boost in speed. Varnish is considered an HTTP accelerator. It is designed specifically for a dynamic range of content heavy websites. Unlike other popular HTTP accelerators that were produced on the side of the client cache, Varnish was created as an HTTP accelerator. In contracts to proxy servers that support network protocols such as SMTP and FTP, this system is focused exclusively on HTTP.
The History of Varnish Cache
The project was originally initiated by an online branch of the Norwegian tabloid newspaper called Verdens Gang. The lead developer and architect is an independent Danish consultant, Poul-Henning Kamp who is also a popular Free BSD core developer. Additional development and management infrastructure were provided by the Norwegian Linux consulting company known as Linpro. The development, management, and support of Varnish were spun off later into a separate company called Varnish Software.
Originally Varnish was released back in 2006 as the version 1.0 of Varnish. The upgraded version known as Varnish 2.0 made its debut in 2008. In 2011 Varnish 3.0 was released.
How Varnish Works
Varnish works by storing web pages in memory so that web servers do not have to produce the same web page repeatedly. It tends to avoid storing cache onto the hard drive. In storing its cache in memory, this system is able to server hundreds of more consecutive requests every second.
Benefits of Varnish
This caching system also has a variety of other advantages and benefits including data base request for content in “real time”, saving more CPU time, and file look-ups. There is a range of other benefits from using Varnish including but not limited to:
- Enhance user experience: With Varnish you will be able to reduce the load time of your website and increase the time your users will spend on the site.
- Improved resilience in regards to failures: Varnish can continue to serve content that is already residing in it cache even if a website owner is experiencing problems with his or her website. This means that Varnish can help to protect you revenue stream.
- Decreased power usage: Serving a page using Varnish takes only about 1% of the resources when serving it from PHP or a similar scripting language.
Web Requests While Using Varnish
More often than not, web requests will usually produce the exact same repeated responses. In a situation like this, the response should ultimately be cached and served fast without consuming any additional resources. However, in the situation that a response hasn’t been cached, a request will be able to pass through to the required resources necessary to produce a response that is cacheable.
Web Requests Without Using Varnish
If you look at a web request while not using Varnish, then multiple database connections and PHP threats may end up producing an increase in CPU consumption. It can also increase response latency.
Varnish Cache Features
Varnish Cache provides users with functionality and is customizable in order to get any job done. It offers a variety of different tools and features, including but not limited to:
- Gzip uncompression and compression
- DNS, Hashing, Random and Client directors that are IP-based
- Grace and saint mode
- Technology preview in regards to HTTP Streaming Pass and Fetch
- Support for persistent storage (excluding LRU eviction)
- Support for Edge Side Includes such as stitching compressed ESI fragments
- Support for plugins with Varnish Modules, also referred to as VMODs
Additional Information on Varnish