Varnish sending 304 back to client on cache miss
Karishma Bagga
kbagga at adobe.com
Mon Apr 15 15:09:32 CEST 2013
My problem is the same as in https://www.varnish-cache.org/lists/pipermail/varnish-misc/2013-April/022991.html
From: Karishma Bagga
Sent: Monday, April 15, 2013 6:27 PM
To: 'varnish-misc at varnish-cache.org'
Subject: Varnish sending 304 back to client on cache miss
Hi
I am facing an issue where Varnish sends a "If-Modified-Since" header for a cache-miss object.
I will briefly describe the system architecture and the problem for your reference. I have varnish logs saved and can share them as well.
1) We have 4 varnish instances running on machine each fetching requests from one backend server. We also have a load balancer in front of these 4 varnishes.
2) We start Varnish processes using : varnishd -f /etc/varnish/default.vcl -s malloc,2G -T 127.0.0.1:2001 -a 0.0.0.0:8081 -n v1
(similarly for v2, v3 and v4). This should make sure that the caches are in memory and exclusive to each varnish instance.
3) We get 200 OK for a URL, and it's there on delivered from the varnish cache; suddenly we get a 304 Not modified in one of the clients and that messes up our playback (this is usually when varnish is under load)
4) On analysis, I figured out that If-Modified-Since header was received at the server end (I can see the header in the Apache logs), since the object was not modified, server returned a 304.
But till then the object was available in the varnish cache. Did Varnish try to invalidate it's cache (as the object ttl was set to 2 seconds). If it did so, shouldn't it keep the object in cache if the server returns a 304?
5) I don't see client adding this header
6) If I do varnishlog -b, I see a request for this URL from varnish(say v1) to backend and also this was a cache miss.
My doubt here is, how does Varnish add If-Modified-Since header if it was a cache miss?
Thanks
Karishma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130415/5f89cffc/attachment-0001.html>
More information about the varnish-misc
mailing list