using grace

Martin Boer martin.boer at netclever.nl
Tue Sep 29 14:42:22 CEST 2009


I'm a bit playing around with set.obj and grace and it's not quite 
working the way I expect.
I would like

0-1.5 minutes; serve object to end user out of cache.
1.5-61.5 minutes; serve object to end user out of cache, fetch new 
object, put that in cache and reset timer for that object.
The latter doesn't seem to work; after 1.5 minutes the loading of a 
webpage is as slow as without using varnish.

Am I using the wrong configuration or is grace not working like I want to ?


At this moment I'm using the following configuration:

DAEMON_OPTS="-a 192.168.100.11:80 \
             -T 192.168.100.11:6082 \
             -f /etc/varnish/bizztravel.vcl \
             -p lru_interval=3600
             -p thread_pool_max=4000 \
             -p thread_pools=4 \
             -p listen_depth=4096 \
             -h classic,500009 \
             -s file,/chroot/varnish/varnish_storage.bin,1G"


sub vcl_recv {
        set req.grace = 60m;
        if (req.url ~ "error.cgi" || req.url ~ "admin" ||  req.url ~ 
"feeds" || req.url ~ "static" ) {
                return(pass);
        }
        if (req.url ~ "whatever") {
                return(pipe);
        }
        return(lookup);
}

sub vcl_fetch {
        if (obj.ttl < 90s) {
                set obj.ttl = 90s;
        }
        set obj.grace = 60m;
        if (req.url ~ "error.cgi" || req.url ~ "admin" || req.url ~ 
"feeds" || req.url ~ "static" ) {
                return(pass);
        }
        if (req.url ~ "^/pics" || req.url ~ "^/css" || req.url ~ "^/js" 
|| req.url ~ "^/images" ) {
                set obj.ttl = 86400s;
        }
        return(deliver);
}



Regards,
Martin Boer



More information about the varnish-misc mailing list