Stale-while-Validate for varnish

Arun Dobriyal arundobriyaliitkgp at gmail.com
Mon Jun 4 14:49:48 CEST 2012


Hi,

 1. I want a state-while-revalidate feature(available in some reverse
proxies like squid) for my varnish server.  In a normal setting with the
grace time, the varnish

makes the first client to wait while the other clients are served stale
content. But I want all clients to be served stale

content, while the refereshing of the cache is done at the background
asychronously (that way no one is kept at waiting) by varnish.

Varnish doesnt support this as of now.. Is there any tweak to achieve it ?



2. I am planning a tweak for the above functionality which is as follows,
for the first request, the varnish normally sends the request it to backend
where its reported as a cache miss and then the request is validated (i
used varnishlog to see that it reports vcl_miss for the first request) ..
whereas for the other queued requests, they are just treated as a normal
cache hit and delivered immediately..

now, I want to stop the first request to wait for the validation, so I am
planning to  somehow find if the current request is a stale request and
within the grace time, if so, I will serve the stale response for it
quickly, and since I want to validate the cache at the backend
asynchronously, I willl send this url to an asynchronous queue which will
cache this request whenever free..

now my question is, how can I find if the request is the first object and
is stale but within the grace time ? If I am able to find this, I can
probably create a Stale-while-Validate for varnish..
Thanks
Arun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120604/f8cb8420/attachment.html>


More information about the varnish-misc mailing list