Member-only story

What Is Varnish and How It Works ?

Maciej
6 min readFeb 1, 2021

--

What is Varnish cache ??

Varnish is a cache server and is designed to use the performance of the OS without duplication. Is installed in the front end to cache static things, and requests that require dynamic processing are often thrown to the back end program through for example Nginx. Since it is premised on a request via http, it may be used on the backend side. Countermeasures for the phenomenon that if the cache lifetime expires when many requests are coming to the same URL with nginx proxy_cache, multiple requests will be sent to the backend for the same URL, which will put a load on the application side.

One of the causes of slow software operation is that the software further implements the functions implemented by the kernel. For example, the kernel implements the functions of disk cache and memory cache. It is usually a duplicate for ordinary software to implement such a function.

Varnish is an implementation that utilizes the knowledge of kernel developers without such duplication. Therefore, writing data to the disk is not performed by default, additionality Cache is cleared when it is restarted.

Key Varnish features

Objects are saved to a file on disk by mmap by default. Also, all cache is lost when the process is restarted. Basic settings like listening port number are given by command line options, and rules as a proxy are described in the configuration file VCL. It does not have a function to write the…

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

No responses yet