Varnish Cache Mechanism

Varnish is a caching HTTP reverse proxy. It receives requests from clients and tries to answer them from the cache.
If Varnish cannot answer the request from the cache it will forward the request to the backend, fetch the response, store it in the cache and deliver it to the client.

Flexibility

One of the key features of Varnish Cache, in addition to its performance, is the flexibility of its configuration language, VCL.
VCL enables you to write policies on how incoming requests should be handled.

In a policy you can decide :
1. What content you want to serve
2. From where you want to get the content and
3. How the request or response should be altered.

Backend servers

Varnish has a concept of backend or origin servers. A backend server to provide the content from Varnish cache.

Our first task is to tell Varnish where it can find its content.
Start your favourite text editor and open the Varnish default configuration file, locate the file named as default.vcl file.
If you installed from source this is /usr/local/etc/varnish/default.vcl, if you installed from a package it is probably at /etc/varnish/default.vcl

If you’ve been following the tutorial there is probably a section of the configuration that looks like this:
vcl 4.0;
backend default {
.host = "www.varnish-cache.org";
.port = "80";
}

  • 23
    Shares

One Reply to “Varnish Cache Mechanism”

Comments are closed.