forked from mtusi2026/mtusi2026lab3
Keep a returning replica out of rotation until its checks pass
The first failover-each run had no errors, yet the balancer counted 19 and 49 redispatches. The HAProxy log showed why: when a stopped container comes back into Docker DNS, its server-template slot leaves MAINT (resolution) as UP/READY at once, before any health check, so requests went to a gunicorn that was not listening yet and were redispatched to the other replica. default-server now sets init-state fully-down (HAProxy 3.1+): at start, on discovery through DNS and on leaving maintenance a server stays DOWN until rise 2 checks pass. A rerun under 100 rps shows zero retries and redispatches for both replicas; rejoining takes about a second longer. The design and the failover spec of the change record the finding. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
85ed37914d
commit
502c7d8ace
@@ -54,7 +54,7 @@ backend api
|
||||
http-request set-var(txn.replay_safe) bool(1) if METH_GET
|
||||
http-request set-var(txn.replay_safe) bool(1) if METH_POST message_path has_key
|
||||
http-request disable-l7-retry unless { var(txn.replay_safe) -m bool }
|
||||
default-server check inter 1s fastinter 500ms downinter 2s fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr none maxconn "${API_SERVER_MAXCONN-64}"
|
||||
default-server check init-state fully-down inter 1s fastinter 500ms downinter 2s fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr none maxconn "${API_SERVER_MAXCONN-64}"
|
||||
server-template api 8 api:8080
|
||||
|
||||
frontend stats
|
||||
|
||||
Reference in New Issue
Block a user