JCM said the following on 09/26/2014 11:46 AM: > On 25 September 2014 14:47, Klavs Klavsen <[email protected]> wrote: >> Any way to make haproxy retry requests with certain http response codes >> X times (or just until all backends have been tried) ? > > Nope. You really don't want to do this. And I'd be sad if the devs > added anything in to HAProxy to enable this. > > You don't know how far through a potentially world-changing operation > the backend managed to get before it threw its error. Did it rollback > correctly? Nothing generic (as HAProxy as middleware is) can figure > this out, so you need to present the error to the consumer and get > them to decide if they want to retry the request. > roll back..I doubt it.
Most sites I serve which gives errors, is not because it was doing anything critical.. sites are typicaly 99% readonly (admin/management pages are typicly hidden somewhere else). Being able to handle if some server fubars itself (in my case one server suddenly had a stale NFS handle) - or if I f.ex. do automatic upgrades.. it's very nice to just know that while the webserver (sometimes a tomcat - which takes ~2 minutes to get ready) gets ready again, my loadbalancer will simply handle failed requests by serving them to the others - until the health checker comes by (if it's really fubar) and removes it. > The ability of Varnish (and Nginx for that matter) to do this is an > anti-feature, IMHO. > You must live in another world than I do. In my world it's a must-have feature. It means that if one server has 10% of it's requests that "screws up" - due to f.ex. a stale nfs handle.. the 90% will still be able to be served by it (ie. it's not pulled out entirely) - and I won't serve broken requests in the "health-check interval" period.. and frankly - I'd would be very sorry to let the health-check pull out the ENTIRE backend server - just because 10% of the site(s) on it are fubar. I'd rather just have it retry another in those 10% cases, until I fix the issue. -- Regards, Klavs Klavsen, GSEC - [email protected] - http://www.vsen.dk - Tlf. 61281200 "Those who do not understand Unix are condemned to reinvent it, poorly." --Henry Spencer

