<div dir="ltr">> Ah, I remember hearing about that earlier, and made a mental note to read up on that. But I forgot all about it. Now I did just that, and boy was that a cold shower for me! I definitely need to unset that header. But why, for the love of all that is holy, does Varnish not include the vary-data in the hash? Why isn't the hash the _single_ key used when storing and looking up data in the cache? Why does Varnish hide this stuff from us?<div><br></div><div>Easy one: you build the key from the request, while the vary header is a response property. Therefore, Varnish can't know to put the varied headers into the hash, because it doesn't have that information yet.</div><div>Basically, the vary header is backend information that allows Varnish to properly differentiate objects with the same hash, and the "hash collision" happens because you, the VCL writer, were not specific enough in vcl_hash (not necessarily your fault, though).</div><div>(technically, and to avoid the wrath of Varnish veterans: it's not a hash collision because the resources technically represent the same resource and the varied headers are just secondary keys).</div><div><br></div><div>> However, when checking the Vary header from the backend, it is set to "Accept-Encoding". And since I haven't changed anything in my browser, it should send the same "Accept-Encoding" request header whenever I surf the website. And since I have visited the startpage multiple times the last 10 days, it should have a cached version of it matching my "Accept-Encoding".</div><div><br></div><div>Don't touch that guy! Varnish will ignore "accept-encoding" in "vary" because it handles compression internally, and always forces "accept-encoding: gzip" before entering vcl_backend_fetch. If your VCL mentions accept-encoding, it's almost always wrong.</div><div><br></div><div>> Well, that gives me nothing that is relevant here, sadly. The last time this happened was a few days ago, and the buffer doesn't seem to be big enough to keep data that far back.</div><div>> But maybe you could describe what you would look for? I would love to learn how to troubleshoot this.<br></div><div><br></div><div>The default VSL space is 80MB, which is "only" worth a few (tens of) thousands requests, so yeah, it can be a short backlog. You can instead start logging into a file:</div><div><br></div><div>> varnishlog -g request -q 'RespStatus eq 500' -w log.bin<br></div><div><br></div><div>once the file grows, you can start looking at it using "varnishlog -r log.bin"</div><div><br></div><div>> Thanks, although most of that stuff I already knew. And it doesn't really give any more advanced examples. Like the problem I mentioned earlier. I really would like to know if it is possible to find the first request where it served the 500 page for the "/" url, as well as the request just before that, for the same url. Do you know how to construct a query that gives me that?</div><div><br></div><div>The problem is that you have to be recording when the initial request goes through. But, if you have then, cache hits will show the VXID of that first request in their "x-varnish" header, and you can find it this way ("varnishlog -r log.bin -q 'vxid == THE_VXID'")</div><div><br></div><div>Hope that helps</div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div><div>Guillaume Quintard<br></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 16, 2021 at 1:33 PM Batanun B <<a href="mailto:batanun@hotmail.com">batanun@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>> Could be a vary issue
<div><br>
</div>
<div>Ah, I remember hearing about that earlier, and made a mental note to read up on that. But I forgot all about it. Now I did just that, and boy was that a cold shower for me! I definitely need to unset that header. But why, for the love of all that is holy,
does Varnish not include the vary-data in the hash? Why isn't the hash the _single_ key used when storing and looking up data in the cache? Why does Varnish hide this stuff from us?</div>
<div><br>
</div>
<div>However, when checking the Vary header from the backend, it is set to "Accept-Encoding". And since I haven't changed anything in my browser, it should send the same "Accept-Encoding" request header whenever I surf the website. And since I have visited
the startpage multiple times the last 10 days, it should have a cached version of it matching my "Accept-Encoding".</div>
<div><br>
</div>
<div>> can you post the output of `varnishlog -d -g request -q 'RespStaus eq 500'?
</div>
<div><br>
</div>
<div>Well, that gives me nothing that is relevant here, sadly. The last time this happened was a few days ago, and the buffer doesn't seem to be big enough to keep data that far back.</div>
<div><br>
</div>
<div>But maybe you could describe what you would look for? I would love to learn how to troubleshoot this.</div>
<div><br>
</div>
<div>> In the meantime, here's a cheat sheet to get started with varnishlog:</div>
<div>> <a href="https://docs.varnish-software.com/tutorials/vsl-query/" target="_blank">https://docs.varnish-software.com/tutorials/vsl-query/</a></div>
<div><br>
</div>
Thanks, although most of that stuff I already knew. And it doesn't really give any more advanced examples. Like the problem I mentioned earlier. I really would like to know if it is possible to find the first request where it served the 500 page for the "/"
url, as well as the request just before that, for the same url. Do you know how to construct a query that gives me that?<br>
</div>
</div>
</div>
</div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>