Saint mode
Javier Frias
jfrias at gmail.com
Tue Sep 1 19:35:43 CEST 2009
On Tue, Sep 1, 2009 at 4:58 AM, Poul-Henning Kamp <phk at phk.freebsd.dk>wrote:
>
>
>
> 503's are never cached to my knowledge.
>
> the rest can be obtained by:
>
> sub vcl_fetch {
> if (beresp.status != 200 && beresp.status != 404) {
> set beresp.ttl = 0;
> return (pass);
> }
> }
>
>
So my setup is a bit different, since I'm one of those that want to server
stuff pass the grace period, if my backends are down. I also want to protect
myself against a self inflicted DoS due to errors. So ideally, saint mode is
what i'd like ( ie, dont store this unless you are a better result )
here's the pertinent configs...
sub vcl_recv {
....
# even though an object may be expired, we want to serve it up for
this long to prevent thread pile up
# we also want to be somewhat aggresive if the backend is
up(healthy)
if (req.backend.healthy) {
set req.grace = 5m;
} else {
set req.grace = 600m;
}
...
}
sub vcl_fetch {
# here, we cache for more time codes that are not server errors
if ( obj.status <500) {
set obj.grace = 600m;
set obj.ttl = 600s;
set obj.cacheable = true;
} else {
set obj.grace = 5s;
set obj.ttl = 60s;
set obj.cacheable = true;
}
}
Before, i use to just have a blanket vcl_fetch setting my grace and ttl,
which is probably the reason why i was caching the 500's
-Javier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20090901/b0cfe570/attachment-0001.html>
More information about the varnish-dev
mailing list