Grace Mode Questions

Vincent cooltechemail at
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;

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:
  set req.grace = 1h;
  set req.grace = 30s;
(I tried the above code and it didn't work)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list