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:
@@ -41,6 +41,17 @@ paths:
|
||||
(psql, стенд `bench/`) не больше `max_connections` Postgres (по
|
||||
умолчанию 100). Расчёт для заявленного числа реплик — в `REPORT.md`;
|
||||
граница пула — одна из гипотез трека 1 (`PLAN.md`).
|
||||
- `idle_in_transaction_session_timeout` — серверная настройка соединений
|
||||
приложения (`server_settings`, рядом с `statement_timeout`) из
|
||||
`[database] idle_in_transaction_timeout_ms` (10 с; 0 — не задаётся).
|
||||
Замороженный процесс (`docker pause`, зависание) держит открытую
|
||||
транзакцию бесконечно: его TCP-соединение живо, keepalive ничего не
|
||||
замечает. Без этой настройки строка ключа идемпотентности, которую он
|
||||
вставил, оставалась бы заблокированной до разморозки, и повтор того же
|
||||
ключа через другую реплику получал бы 503 снова и снова. Значение
|
||||
больше `request_timeout_seconds` (валидатор `Database`): транзакция
|
||||
живого запроса дольше не живёт, `get_db_session` закрывает соединение
|
||||
по сроку (design change `graceful-failover`, решение 4).
|
||||
- `command_timeout` asyncpg не использовать: на таймауте он отменяет
|
||||
запрос через новое соединение и ждёт сервер без срока, и замёрзший
|
||||
Postgres держит запрос до разморозки. Срок запроса ставит
|
||||
|
||||
Reference in New Issue
Block a user