Thanks Raymond.

If we don't hear any views to the contrary from Varnish themselves, we'll go 
with the standard approach of using obj.hits

Regards,
Umesh

From: "<Jennings III>", Raymond 
<[email protected]<mailto:[email protected]>>
Date: Thursday, 2 April 2015 13:38
To: Umesh Telang <[email protected]<mailto:[email protected]>>
Cc: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: Determining a HIT or a MISS in Varnish 4 VCL

I think that's the way - exactly as you have in vcl_deliver.  I've always used 
that in V3 and now in V4 as well.

I'm suspect of that page telling you to not use obj in vcl_deliver but use that 
header value instead.

Raymond Jennings III
nytimes.com<http://nytimes.com/>
Office: 212.556.7786<tel:212-556-7786>
iPhone: 914.330.5074<tel:914-330-5074>
E-mail: [email protected]<mailto:[email protected]>
FaceTime: [email protected]<mailto:[email protected]>

On Thu, Apr 2, 2015 at 8:28 AM, Umesh Telang 
<[email protected]<mailto:[email protected]>> wrote:
Hello,

It's unclear if the way to detect whether a particular response was the result 
of a cache hit or miss in VCL, has changed from Varnish 3 to Varnish 4.

At this page (not an official Varnish page...), it suggests using the value of 
resp.http.X-Varnish (whether it has a single or multiple values) to determine 
this:
http://foshttpcache.readthedocs.org/en/latest/varnish-configuration.html#

Alternatively I've also seen suggestions for continuing to use obj.hits in 
vcl_deliver. e.g. :
sub vcl_deliver {
if (obj.hits > 0) { # Add debug header to see if it's a HIT/MISS and the number 
of hits, disable when not needed
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
}

We've observed that the value of %{Varnish:handling}x in the varnish ncsa log 
has been accurate in reporting HITs vs MISSes. Could we use a VCL equivalent of 
this in vcl_deliver to determine whether a particular response is the result of 
a HIT or a MISS?

Any advice on the recommended way in VCL to determine whether a response is the 
result of a HIT or MISS would be greatly appreciated!

Thanks,
Umesh

_______________________________________________
varnish-misc mailing list
[email protected]<mailto:[email protected]>
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to