What Is Varnish Cache In Layman’s Terms
Varnish is a reverse web proxy caching system. It basically acts as an operator or a security guard, by intercepting all web requests before they reach your web server (apache).
How It Works
Varnish stores it’s cache in memory and not so much on the hard drive. In doing so, it is able to serve hundreds of more consecutive requests per second. This caching has other advantages like saving CPU time, file lookups and database requests for content that is not particularly “real-time”. Let’s take a look at what a web request might look like when using varnish.
Web Requests on a Server With Varnish
Web requests will most often produce the same repeated response. In which case the response should be cached and servered quickly without consuming additional resources. In the case that a response has not been cached, the request is allowed to pass through to necessary resources in order to produce a cacheable response.
Web Requests on a Server Without Varnish
Multiple PHP threads and database connections may produce high CPU consumption and increase response latency.
The above images can be reused and copied. They are on a public Google Doc.