Varnish 6 is the latest major version of the Varnish project, and although it sounds new and shiny, the first release of Varnish 6 dates all the way back to March 15th 2018, when Varnish Cache 6.0.0 was announced.
Later that year Varnish Enterprise 6 was released to all customers as version 6.0.1r1. Prior to this, some limited availability versions were produced and tested by select customers. With the release of 6.0.1r1, all the features from the 4.1 version of the enterprise product had been brought to the latest version, and even more features unique to Varnish Enterprise 6 were introduced. These features will be discussed later in this chapter.
Right now, Varnish Cache 6.6.0 is the latest version, which was released on March 15th 2021. Even though the recent release has a much higher version number, only 6.0 has the status as a long-term support (LTS) release.
Such an LTS release will receive bugfixes and support for an extended length of time: at least for half a year after the next LTS has been announced. Varnish Software maintains this release, and provides packages for free to the general public.
All versions of Varnish Cache prior to 6.0 are deemed end-of-life, while Varnish Software still supports older versions of Varnish Enterprise.
Varnish 6 is already two years old. But there is still a lot of content available, written for versions that have reached their end-of-life date.
A lot of it is based on Varnish version 4.1. I even wrote a book about Varnish 4, which is still available. And although a lot of the concepts and VCL examples still hold up, it is important to educate people on the current state of the project.
The Varnish development team strives to be backwards compatible. This means that almost all VCL examples written for Varnish 4.0 and 4.1 will work in exactly the same way in Varnish 6. However, there are often better ways of doing things in the newer versions, so not all of the advice is still current.
This book focuses on version 6, and many of the VCL examples in this book will not work with older versions of Varnish.
We must however make a clear distinction between the version of Varnish itself, and the VCL syntax versions.
When Varnish 4.0.0 was released in 2014, there were a lot of breaking changes to the VCL syntax. Most notably, backend and client request handling was separated, introducing several new states in the Varnish Finite State Machine.
As a mechanism for handling developments in the language itself, at the
time and in the future, Varnish Cache 4.0 introduced a new
requirement: from that version on, every valid VCL file must start with
a line defining the VCL version to use. For a long time, only vcl 4.0;
was allowed.
Throughout the years, Varnish version numbers have increased, major releases like Varnish 5 and 6 happened, but the syntax remained compatible.
For a lot of people, VCL is the way they interface with Varnish. If the VCL syntax doesn’t change, it seems as though the project doesn’t evolve either.
In reality, a lot of change has happened, and a lot of change is still taking place right now. When Varnish 6 was released, VCL syntax 4.1 was introduced, while using the 4.0 syntax is still allowed.
Support for Unix domain sockets (UDS) in Varnish was the feature that
required your VCL file to start with vcl ``4.1;.
It is important to understand that even though the VCL language was kept
at a constant version for a long time, capabilities were added to it. In
other words, it was kept backwards compatible, but not forward
compatible. Most of these additions were in form of new VCL variables
like, for example, req.grace, or local.socket.
The main problem with outdated Varnish content on the internet, and in professional literature, is that it doesn’t represent the most efficient way to tackle certain issues that Varnish is suited for.
The lack of modern Varnish content on blogs, on GitHub, and on platforms like Stack Overflow, does not encourage users the install the latest major version.
When sharing new VCL snippets, we should make sure they start with
vcl 4.1;. Because that’s how we ensure people run them on a recent
version of Varnish.
Encouraging upgrades from a feature perspective is one way to approach this challenge. Another equally compelling argument is the fact that Varnish 6 is faster than previous versions, is more stable, less resource consuming, and more secure.
Varnish Cache 6 is an active project, Varnish Enterprise 6 is an active product. Both will continue to receive bugfixes, security updates, and feature additions. As a Varnish evangelist, I strongly advise you to upgrade to this version in your current setup, or to install this version on new setups.
A conservative approach and critical thinking are generally good qualities for any operations engineer to have. They’re part of the risk mitigation mindset that gives organizations peace of mind.
Sticking with older versions that you know and trust is a common strategy: if it ain’t broken, don’t fix it. However, as another saying goes: you have to get with the times:
Do yourself a favor, upgrade to Varnish 6, even if Varnish is not a cornerstone of your setup or platform.