Possible to detect a previous xkey softpurge?

Guillaume Quintard guillaume at varnish-software.com
Thu Sep 3 14:27:08 UTC 2020


Hi,

You can't detect a softpurge, but you can tell Varnish to ignore grace:

```
sub vcl_recv {
    if (req.http.no-grace) {
        set req.grace = 0s;
    }
}
```

the softpurge kill the ttl at the object level, and this kills the grace at
the request level, so Varnish will reach out to the backend.

But note that it will also do the same even without a prior softpurge, it
just needs an expired ttl.

-- 
Guillaume Quintard


On Thu, Sep 3, 2020 at 3:57 AM Batanun B <batanun at hotmail.com> wrote:

> Hi,
>
> We sometimes have a problem with the backend using its internal cache for
> a few seconds too long after something has been updated. We trigger a
> softpurge (xkey vmod) in varnish, but if someone requests the page again
> very soon after that, the data that Varnish gets from the backend might be
> old. In this case, we would like to be able to tell the backend, maybe
> using an extra header, that it should skip its internal caches and give us
> the updated content.
>
> But, I'm not sure how to archive this in Varnish. Is it possible to detect
> that the page requested has been softpurged earlier? If yes, is it also
> possible to see when that softpurge took place? Because we would only ever
> need to do this if the softpurge happened less than let's say 30 seconds
> ago.
>
> And the reason that the backend data might be old after an update is that
> what we call "the backend" (from a Varnish perspective) is actually a
> complex setup of services. And there, the update happens in one place, and
> our "backend" is actually a frontend server that sometimes don't get the
> information about the update quick enough. I think that the implementation
> of this system is a bit faulty, but it is what it is, and I would like to
> use the power of Varnish to handle this, if possible.
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20200903/eeabbb82/attachment.html>


More information about the varnish-misc mailing list