Handling 400's without saint mode

maillists0 at gmail.com maillists0 at gmail.com
Wed Jul 16 23:54:47 CEST 2014


Thanks for the response. Setting saintmode_threshold made it behave more
like what I expected.

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?

HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 75
Content-length: 146369
Content-Type: text/css
Date: Wed, 16 Jul 2014 21:27:24 GMT
Last-Modified: Wed, 16 Jul 2014 21:23:09 GMT
Server: AmazonS3
Via: 1.1 varnish
X-Cache: HIT
X-Cache-Hits: 59
X-Cacheable: YES
X-Varnish: 1189098768 1189098616
Connection: keep-alive

HTTP/1.1 404 Not Found
Accept-Ranges: bytes
Age: 0
Content-length: 349
Content-Type: text/html; charset=utf-8
Date: Wed, 16 Jul 2014 21:27:25 GMT
Server: AmazonS3
Via: 1.1 varnish
X-Cache: MISS
X-Cacheable: NO:Bad status
X-Varnish: 1189098774
Connection: keep-alive

HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 78
Content-length: 146369
Content-Type: text/css
Date: Wed, 16 Jul 2014 21:27:26 GMT
Last-Modified: Wed, 16 Jul 2014 21:23:09 GMT
Server: AmazonS3
Via: 1.1 varnish
X-Cache: HIT
X-Cache-Hits: 60
X-Cacheable: YES
X-Varnish: 1189098775 1189098616
Connection: keep-alive



On Wed, Jul 16, 2014 at 9:12 AM, Lasse Karstensen <
lkarsten at varnish-software.com> wrote:

> On Wed, Jul 16, 2014 at 08:05:15AM -0400, maillists0 at gmail.com wrote:
> > Using Varnish 3.x to retrieve objects from s3. Due to a release process
> > that is beyond my control, some items are occasionally unavailable for 3
> to
> > 5 minutes when they're being recreated. Saint mode doesn't seem to do
> what
> > I need here.
> > What I really want is to check the backend first and then serve from
> cache
> > on a 400 for each request to this backend. Is that possible with Saint
> > mode, or is there a better way to do this?
>
> Saint mode and grace should help you out here.
>
> Something like this could perhaps work:
>
>         backend s3server {
>             .host = ..
>             .saintmode_threshold = 999999999;
>         }
>
>         sub vcl_recv {
>                 set req.grace = 10m;
>         }
>
>         sub vcl_fetch {
>                 set beresp.grace = 10m;
>                 if (req.backend == s3server && beresp.status == 400) {
>                         set beresp.saintmode = 300s;
>                         return(restart);
>                 }
>         }
>
> Any URLs giving a 400s from s3server is then marked as sick for 300s.
>
> As long as there is an old version of the object still in cache, give
> that to this and any clients asking for this URL for the next 300s.
>
>
> --
> Lasse Karstensen
> Varnish Software AS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140716/9a593e3c/attachment.html>


More information about the varnish-misc mailing list