<div dir="ltr"><div>Thanks for the response. Setting saintmode_threshold made it behave more like what I expected. <br><br></div>I have saintmode set to 300 seconds. To test, I'm making a single request in a loop, then moving the file. While Varnish is in Saint mode, I see these sorts of responses. Note that the age goes from 75 to 0 to 78, and the X-Varnish fields are different. It really looks like two different things are being cached for the same request, but I don't know how that's possible. Suggestions on where to look?<br>
<br>HTTP/1.1 200 OK<br>Accept-Ranges: bytes<br>Age: 75<br>Content-length: 146369<br>Content-Type: text/css<br>Date: Wed, 16 Jul 2014 21:27:24 GMT<br>Last-Modified: Wed, 16 Jul 2014 21:23:09 GMT<br>Server: AmazonS3<br>Via: 1.1 varnish<br>
X-Cache: HIT<br>X-Cache-Hits: 59<br>X-Cacheable: YES<br>X-Varnish: 1189098768 1189098616<br>Connection: keep-alive<br><br>HTTP/1.1 404 Not Found<br>Accept-Ranges: bytes<br>Age: 0<br>Content-length: 349<br>Content-Type: text/html; charset=utf-8<br>
Date: Wed, 16 Jul 2014 21:27:25 GMT<br>Server: AmazonS3<br>Via: 1.1 varnish<br>X-Cache: MISS<br>X-Cacheable: NO:Bad status<br>X-Varnish: 1189098774<br>Connection: keep-alive<br><br>HTTP/1.1 200 OK<br>Accept-Ranges: bytes<br>
Age: 78<br>Content-length: 146369<br>Content-Type: text/css<br>Date: Wed, 16 Jul 2014 21:27:26 GMT<br>Last-Modified: Wed, 16 Jul 2014 21:23:09 GMT<br>Server: AmazonS3<br>Via: 1.1 varnish<br>X-Cache: HIT<br>X-Cache-Hits: 60<br>
X-Cacheable: YES<br>X-Varnish: 1189098775 1189098616<br>Connection: keep-alive<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 16, 2014 at 9:12 AM, Lasse Karstensen <span dir="ltr"><<a href="mailto:lkarsten@varnish-software.com" target="_blank">lkarsten@varnish-software.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Jul 16, 2014 at 08:05:15AM -0400, <a href="mailto:maillists0@gmail.com">maillists0@gmail.com</a> wrote:<br>

> Using Varnish 3.x to retrieve objects from s3. Due to a release process<br>
> that is beyond my control, some items are occasionally unavailable for 3 to<br>
> 5 minutes when they're being recreated. Saint mode doesn't seem to do what<br>
> I need here.<br>
> What I really want is to check the backend first and then serve from cache<br>
> on a 400 for each request to this backend. Is that possible with Saint<br>
> mode, or is there a better way to do this?<br>
<br>
</div></div>Saint mode and grace should help you out here.<br>
<br>
Something like this could perhaps work:<br>
<br>
        backend s3server {<br>
            .host = ..<br>
            .saintmode_threshold = 999999999;<br>
        }<br>
<br>
        sub vcl_recv {<br>
                set req.grace = 10m;<br>
        }<br>
<br>
        sub vcl_fetch {<br>
                set beresp.grace = 10m;<br>
                if (req.backend == s3server && beresp.status == 400) {<br>
                        set beresp.saintmode = 300s;<br>
                        return(restart);<br>
                }<br>
        }<br>
<br>
Any URLs giving a 400s from s3server is then marked as sick for 300s.<br>
<br>
As long as there is an old version of the object still in cache, give<br>
that to this and any clients asking for this URL for the next 300s.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Lasse Karstensen<br>
Varnish Software AS<br>
</font></span></blockquote></div><br></div>