Varnish Cache 3.0 (the open source project) was released back in 2011 while Varnish Cache 4.0 made its debut in 2014. Since then, we’ve seen Varnish Cache 4.1.x appear, and now, the most recent, Varnish 5.0, which was only recently released.
Varnish Cache 3.0 has reached end-of-life, and is no longer maintained. That means you should definitely migrate to a more stable, supported, better-performing and feature-complete Varnish Cache version.
Migrations are always time-consuming and potentially problematic, but hopefully this blog post will help you to have a smoother transition.
Why explain the differences between Varnish Cache 3.0 and Varnish Cache 4.0 when the latest version is 5.0?
sub vcl_hit {
if (obj.ttl >= 0s) {
# fresh object present in cache
# normal hit
return (deliver);
}
# We have no fresh objects. Let’s look at the stale ones
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s
# A background fetch is triggered to fetch a fresh object.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";
return (deliver);
} else {
# No candidate for grace. Fetch a fresh object.
return(fetch);
}
} else {
# backend is sick - use full grace
# a background fetch is triggered to try to fetch fresh content
if (obj.ttl + obj.grace > 0s) {
set req.http.grace = "full";
return (deliver);
} else {
# no graced object.
return (fetch);
}
}
}
More on this at “man vmod_directors”.
sub vcl_recv {
…
if (req.method == “PURGE”) {
return(purge);
}
}
On top of these changes, more new features have been developed in the commercial version of Varnish, between Varnish Cache Plus 3.0 and the newer Varnish Cache Plus 4.x.
Just to name some of them:
There can be plenty of pitfalls in migrating, but hopefully this helps you as you make the important migration from Varnish 3 to Varnish 4 and take advantage of the improvements Varnish 4 offers.
And, even when you're not migrating, there are some common Varnish mistakes you can avoid while configuring. Watch our webinar, 10 Varnish Cache mistakes and how to avoid them, to find out more.
Photo (c) 2015 Ben Blash used under Creative Commons license.