you need to enable a probe in the backend for this to work i believe.<div><br></div><div><br><br><div class="gmail_quote">On Mon, Mar 7, 2011 at 3:58 PM, Drew Smathers <span dir="ltr"><<a href="mailto:drew.smathers@gmail.com">drew.smathers@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi all,<br>
<br>
I'm trying to grace as a means of ensuring that cached content is<br>
delivered from varnish past it's TTL if backends can't generate a<br>
response. With some experiments this does not seem to happen with our<br>
setup. After an object is cached, varnish still returns a 503 within<br>
the grace period if a backend goes down. Below are details.<br>
<br>
version: varnish-2.1.4 SVN 5447M<br>
<br>
I stripped down my VCL to the following to demonstrate:<br>
<br>
backend webapp {<br>
    .host = "127.0.0.1";<br>
    .port = "8000";<br>
}<br>
<br>
sub vcl_recv {<br>
   set req.backend = webapp;<br>
   set req.grace = 1h;<br>
}<br>
<br>
<br>
sub vcl_fetch {<br>
   set beresp.grace = 24h;<br>
}<br>
<br>
Running varnish:<br>
<br>
varnishd -f simple.vcl -s malloc,1G -T <a href="http://127.0.0.1:2000" target="_blank">127.0.0.1:2000</a> -a <a href="http://0.0.0.0:8080" target="_blank">0.0.0.0:8080</a><br>
<br>
<br>
First request:<br>
<br>
GET /some/path/ HTTP/1.1<br>
Accept-Language: en<br>
<br>
HTTP/1.1 200 OK<br>
Server: WSGIServer/0.1 Python/2.6.6<br>
Vary: Authorization, Accept-Language, X-Gttv-Apikey<br>
Etag: "e9c12380818a05ed40ae7df4dad67751"<br>
Content-Type: application/json; charset=utf-8<br>
Content-Language: en<br>
Cache-Control: max-age=30<br>
Content-Length: 425<br>
Date: Mon, 07 Mar 2011 16:12:56 GMT<br>
X-Varnish: 377135316 377135314<br>
Age: 6<br>
Via: 1.1 varnish<br>
Connection: close<br>
<br>
<br>
Wait 30 seconds, kill backend app, then make another request through varnish:<br>
<br>
GET /some/path/ HTTP/1.1<br>
Accept-Language: en<br>
<br>
HTTP/1.1 503 Service Unavailable<br>
Server: Varnish<br>
Retry-After: 0<br>
Content-Type: text/html; charset=utf-8<br>
Content-Length: 418<br>
Date: Mon, 07 Mar 2011 16:14:02 GMT<br>
X-Varnish: 377135317<br>
Age: 0<br>
Via: 1.1 varnish<br>
Connection: close<br>
<br>
Any help or clarification on request grace would be appreciated.<br>
<br>
Thanks,<br>
-Drew<br>
<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div><br></div>