load balancing - HAproxy passive health checking -
i'm new haproxy , load balancing. want see happens when backend host turned off while proxy running.
the problem is, if turn off 1 of backends , refresh browser page immediateltly exposes 503 error user. after next page load, no longer gets error since presumably backend has been removed pool.
as test have set 2 backend flask apps , configured haproxy balance them so:
backend app mode http balanace roundrobin server app1 127.0.0.1:5001 check server app2 127.0.0.1:5002 check
my understanding according this: https://www.haproxy.com/doc/aloha/7.0/haproxy/healthchecks.html#check-parameters
is every 2 seconds backend hosts pingged see if up. removed pool if down. 5xx error happens between time kill backend , 2 seconds.
i think there way around 5xx error having haproxy perform little logic such if request frontend fails, remove failed backend pool , switch , make request. way user never see failure.
is there way this, or should try else user not error?
by default haproxy retry 3 times (retries
) 1s intervals the same backend. in order allow take backend should set option redispatch
.
also consider (carefully, can hamrfull):
- decrease
fall
(default 3), - decrease
error-limit
(default 10) , seton-error
mark-down
orsudden-death
- tune healthcheck intervals
inter
/fastinter
/downinter
note: haproxy retries on connection errors (e.g. econnnrefused
in case), not resend/resubmit request/data.
Comments
Post a Comment