HTTP Accelerator Cache: Varnish
The Varnish is an open-source reverse proxy server. Its primary purpose is to cache HTTP responses. Besides it also enables modifying HTTP requests/ response to the origin.
The Varnish documentation highlights that the server is highly scalable on a multi-core system, efficient (uses mostly kernel services such as kqueue, epoll, memory management). It’s developed in C.
The reverse proxy sits between the client (browser) and the server (origin).
It has a few interesting use cases such as:
- Modifying cookies in the request
- Appending/removing headers in request/response (e.g. changing Host header)
- Prevents Cache Stampede (on a miss, many fetches won’t cause many reads from the origin). It uses TTL + Grace period for cached objects. After TTL is expired, Varnish fetches the object asynchronously.
Written with StackEdit.