Search

What is VCL again?

What is VCL again?

VCL is a domain-specific language, meaning that it can only be used for Varnish and has no other application.

The Varnish Configuration Language has a curly braces syntax style and feels familiar to languages like C, C++, C#, Java, and many more.

VCL code is written in a VCL file, which is picked up by the varnishd process on startup. The -f runtime parameter refers to the VCL file that needs to be loaded.

Upon startup, VCL code is translated into C code, which in turn gets compiled. The shared object that results from this compilation process is loaded into the Varnish server process.

The fact that the code gets compiled and is not interpreted at runtime makes VCL a very fast programming language. This is not a side effect, but a design goal, since Varnish is all about speed and scalability.

VCL is not a typical top-down programming language. VCL is a language that hooks into various states of a finite state machine. This allows VCL to extend the built-in VCL behavior of Varnish.

We’ll cover the finite state machine in the coming sections, and the built-in VCL code will be covered at the end of this chapter.

VCL is primarily used for request and response manipulation, backend routing, and the execution of caching policies.

In more advanced use cases, VCL will be used to control web application firewall features, to offload authentication, to parse and process edge side includes, and to modify the response body based on interaction with third-party services. And that is what we call edge computing.


®Varnish Software, Wallingatan 12, 111 60 Stockholm, Organization nr. 556805-6203