Grace Mode Questions

Vincent cooltechemail at gmail.com
Sun Nov 14 04:18:45 CET 2010


Hi All,

I am using the grace mode and I am wondering how the old objects are stored
and used in varnish. For example, if I have the following setup:

sub vcl_recv {
  set req.grace = 30m;
}
sub vcl_fetch {
    set beresp.ttl =1m;
    set beresp.grace = 1h;
        if (beresp.status != 200 && beresp.status != 403 && beresp.status !=
404 && beresp.status != 301 && beresp.status != 302) {
            set beresp.saintmode = 30s;
            restart;
        }
}

My questions are:
1) Since all objects have a ttl of 1m, and the req.grace is 30m. Does this
mean varnish will keep all expired objects in the past 30 minutes, which
lead to 30 expired objects for each object. Or, Varnish only keeps the most
recent expired object?

2) in vcl_recv, can varnish check if the object is in saintmode so we can
set the grace longer? For example, can we do something like:
if(req.saintmode){
  set req.grace = 1h;
}
else{
  set req.grace = 30s;
}
(I tried the above code and it didn't work)



Thanks,

Vincent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20101113/95c68f95/attachment-0003.html>


More information about the varnish-misc mailing list