feat: coordinate timeout chain and add failover load profile

HAProxy checks get fastinter 500ms and timeout check 2.5s (hung replica
detected within 6.5 s), http-reuse never with uvicorn keep-alive 60 s so
the LB closes idle replica connections, and app connections set
idle_in_transaction_session_timeout so a frozen replica releases its
idempotency key. The bench stand runs behind HAProxy with N replicas and
gains the failover profile (make bench_failover / bench_failover_quick):
constant-rate writes with a key and reads while each replica is stopped,
killed or paused, with per-second timeline, detection and recovery time
and write reconciliation. Driver commands idle-conns and hang-key check
the keep-alive and hung-transaction decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 23:21:12 +03:00
co-authored by Claude Opus 5.5
parent b76a666621
commit 459f84c75c
25 changed files with 2400 additions and 269 deletions
+9
View File
@@ -9,6 +9,11 @@
log_level = "INFO"
# сколько секунд uvicorn ждёт текущие запросы после SIGTERM
graceful_shutdown_seconds = 8
# сколько секунд uvicorn держит простаивающее keep-alive соединение;
# больше, чем HAProxy держит простаивающее соединение с репликой (timeout
# http-keep-alive 10 с, http-reuse never в infra/haproxy/haproxy.cfg):
# простаивающее соединение закрывает LB
keep_alive_seconds = 60
# instance_id (X-Instance-Id) здесь не задавать: config.toml общий у всех
# реплик, а значение должно различаться. Без него берётся hostname
# процесса (в compose — короткий ID контейнера); в консоли его можно
@@ -27,6 +32,10 @@ connect_timeout_seconds = 3
statement_timeout_ms = 5000
# секунды на всю работу запроса с БД: зависший сервер, обрыв сети
request_timeout_seconds = 6
# миллисекунды, серверный idle_in_transaction_session_timeout: транзакцию
# замороженной реплики PostgreSQL прерывает и снимает её блокировки.
# 0 — без ограничения, иначе больше request_timeout_seconds
idle_in_transaction_timeout_ms = 10000
[auth]
# секунды жизни сессии с момента входа (контрактное имя