retry on 503 -- but not right away please

Andreas Plesner Jacobsen apj at mutt.dk
Wed Apr 25 15:08:35 CEST 2012


On Wed, Apr 25, 2012 at 01:57:53PM +0200, Jan-Frode Myklebust wrote:
> 
> 		if (obj.status == 503) {
> 			if ( req.restarts < 12 ) {
> 				restart;
> 			}
> 
> but it didn't seem to have the desired effect. We still get the 503's. Maybe 
> varnish is trying again too quickly..  Is it possible to either insert a
> short delay before restarting here? Or possibly send the client a HTTP 307
> pointing at the same URL to cause a delay that way?

The only effect of the above is probably that you're DoSing the backend :)
And unless you changed the default, max_restarts will kick in before you reach 12.

> Any other ideas?

I don't understand why you're seeing this 503 in vcl_error. A backend
responding with a 503 would just hit the regular fetch->deliver path, not
vcl_error, unless you explicitly return error somewhere in your vcl, so maybe
your initial analysis of the problem is wrong?

I think my preferred solution would be to return some synthetic page with meta
refresh (and that would require you to use error, since that's the only place
you can do synthetic currently).

-- 
Andreas



More information about the varnish-misc mailing list