Using obj.hits, clearly a hit and miss affair

VCL is awesome, but it's also a bit frightening to newcomers, and most of the time, people are more interested in something that "just works"™ than "doing the right thing"™ and they google their way out of it.

Problem is that the first thing that sort of works isn't necessarily the right thing, and the proliferation of one particular code snippet is what prompted the writing of this post. The snippet in question? This guy:

sub vcl_deliver {
    if (obj.hits > 0) {
        set resp.http.X-Cache = "HIT";
    } else {
        set resp.http.X-Cache = "MISS";
    }
}

Recognize it? Have it somewhere in your code, maybe? If so, read on, and let's try to do the right thing, and hopefully, get a better setup thanks to it. Don't worry, this is a short one, so hop in.

Read More

26/07/18 13:00
by Guillaume Quintard

Ending the pipe dream: when to use pipe in Varnish

As you may know, part of my job consists of helping Varnish users, both customers and community users (join us on IRC!), often looking at their VCL and see if there's anything wrong. And sometimes, there is. After all, VCL is a programming language and mistakes happen. However, one point stands out as being badly understood, and I feel it deserves a short blog post to set the record straight.

Read More

14/03/18 14:00
by Guillaume Quintard

Painful Varnish mistakes

This post was initially titled "Top 6 Varnish mistakes", to echo Espen's blog.  Even though his material is three years old, the content is still relevant. Plus, there's a healthy colleague competition going on here, and I can't just mimic Espen if I hope to beat him, so I had to do something different.
 
Instead, I'm going to compete on brutality: this post isn't about explaining the most common mistakes, but rather the ones that can really kill your service, one way or another. I know it sounds a bit scary, and it is, but that's for your own good, really. So buckle up, and let's see what I have in my Little Shop of Errors.
Read More

21/11/17 14:16
by Guillaume Quintard

Varnish Software Blog

The Varnish blog is where the our team writes about all things related to Varnish Cache and Varnish Software...or simply vents.

SUBSCRIBE TO OUR BLOG

Recent Posts

Posts by Topic

see all