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
@@ -9,6 +9,7 @@
|
||||
|
||||
- [x] 2.1 `compose.yaml`: явные `DRAIN_SECONDS`, `DB_ACQUIRE_TIMEOUT_SECONDS`, `DB_COMMAND_TIMEOUT_SECONDS` у `api`; сервис `k6` под профилем `bench`; `.env.example`, Dockerfile
|
||||
- [x] 2.2 Тест цепочки таймаутов по `compose.yaml`, `haproxy.cfg` и `scripts/stop-one.sh`
|
||||
- [x] 2.4 HAProxy `init-state fully-down`: вернувшаяся через DNS реплика ждёт `rise 2` проверок
|
||||
- [x] 2.3 Проверка группы: `docker compose --profile bench config --quiet`, `make student-test -k "timeouts or drain"`
|
||||
|
||||
## 3. Нагрузка и зонд
|
||||
|
||||
Reference in New Issue
Block a user