Hi,

I have started writing up a suggestion following an irc discussion about
Federicos patch. I wanted to suggest to also add stale-if-error (s-i-e) support
but really I don't see a way at the moment to achieve this without added
functionality in vcl - am I missing something?

For s-i-e, I think we need to handle the case of a synchronous backend fetch (ie
one with one or more frontend requests waiting for the result) resulting in "an
error". We'd have to restart the frontend request once and check for a stale
object as in

        vcl_hit {
                // got here not because of grace but because of
                // keep or some other parameter
                if (req.restarts == 1) {
                        return (deliver);
                }
        }

The options I see at the moment to achieve this would all require additions to 
VCL:

- something along the lines of a beresp.fetched ("this object originated
  from a fetch initiated by this req"):

  vcl_deliver {
        if (beresp.fetched && req.restarts == 0 && beresp.status >= 500) {
                return (restart);
        }
  }

OR

- some way to determine in v_b_e and v_b_r if the bereq is synchronous
  and restart the req.

 sub vcl_backend_(response|error) {
        if (bereq.synchronous.req && beresp.status > 500) {
                restart(bereq.synchronous.req);
        }
}

                
Thanks, Nils

_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to