retry on 503 -- but not right away please

Jan-Frode Myklebust janfrode at tanso.net
Wed Apr 25 13:57:53 CEST 2012


We have a backend apache server that will generate 503 errors on some files
because of a TOCTOU problems while replacing the files. Unfortunately we
see no way of fixing the updates of these files to be atomic, and avoid
the problem -- so I was hoping varnish might be able to solve it for us.

I tried to have varnish retry on 503 using:

=========================================================
	sub vcl_error {
		# retry on errors
		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?

Any other ideas?


  -jf



More information about the varnish-misc mailing list