Possible to detect a previous xkey softpurge?
Guillaume Quintard
guillaume at varnish-software.com
Thu Sep 3 17:02:56 UTC 2020
Wait a minute, I only offered to reduce the grace depending on a header
because I thought you only wanted to do that for some privilege clients.
>From what I understand now, you want to make sure that after a softpurge,
you never get the stale object. So, if I may: why use a softpurge at all?
Just remove the objects completely and be done with it.
--
Guillaume Quintard
On Thu, Sep 3, 2020 at 9:55 AM Batanun B <batanun at hotmail.com> wrote:
> Hi,
>
> I'm not sure how that "no-grace" header would be set. The softpurge could
> theoretically impact hundred of URLs, and what we would like is that any
> requests for these URLs after the softpurge should include a special header
> when talking with the backend.
>
> Skipping grace in general, and sending that special header to all requests
> to the backend, is not what we want.
>
> But now I am thinking of an alternative, that might give us somewhat what
> we want while being much simpler and not needing to know if a softpurge has
> happened or not. Since we really only need to do this in a short time
> period after a softpurge, and the softpurge sets ttl to zero, then we can
> skip the "after a softpurge" requirement and simply check if the ttl
> recently expired. As far as I understand it, when the ttl has expired, the
> obj.ttl is a negative value indicating how many seconds since the ttl
> expired. So 15 seconds after the ttl, it would be -15s. Then we can have
> something like this in in vcl_hit:
>
> ```
> if (obj.ttl > -15s) {
> set req.http.X-my-backend-skip-cache = "true";
> return (miss);
> }
> ```
>
> I can't check this right now, from the computer I am at. But it should
> work, right? Then the only "false positives" we will end up with are the
> requests that happen to come in within 15 seconds of the regular ttl
> expiring. But if we get the cache invalidation to work fully (including in
> the backend), then we should be able to increase the regular ttl higher
> than the current 5s, and then this false positive should happen much more
> rarely.
>
>
> Guillaume Quintard <guillaume at varnish-software.com> wrote:
> >
> > 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.
> >
> _______________________________________________
> 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/27c82675/attachment-0001.html>
More information about the varnish-misc
mailing list