Files
mtusi2026lab3/bench/bench.compose.yml
T
ricoromaandClaude Opus 5.5 459f84c75c 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>
2026-10-10 23:21:12 +03:00

84 lines
4.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Override стенда make bench (bench/run.py): тот же docker-compose.yml под
# проектом mtusi-bench, со своими volume, сетью и лимитами. Пины, healthcheck
# хранилищ, valkey.conf, haproxy.cfg и миграции — из основного файла.
# Подстановки — из bench/bench.env, а не из .env рабочего стенда; пароли и
# BENCH_* передаёт run.py (поля Profile), без них стенд не поднимается.
# Решения 1, 2, 5 design change bench-postgres и 6 design change
# graceful-failover; что не меняется между метками — .claude/rules/bench.md.
# Стенд — HAProxy перед BENCH_API_REPLICAS репликами api, как рабочий; k6
# ходит через LB по имени сервиса haproxy. Лимиты — в форме
# deploy.resources.limits, как в основном файле: compose не принимает
# cpus/mem_limit рядом с deploy-лимитами.
services:
postgres:
container_name: mtusi-bench-postgres
# упавший контейнер не поднимается сам: прогон помечается stand_down
restart: "no"
# auto_explain загружен, но выключен (log_min_duration = -1): run.py
# включает его только на этапе плана, между прогонами
command: ["postgres", "-c", "shared_preload_libraries=auto_explain"]
ports: !reset []
deploy:
resources:
limits:
cpus: ${BENCH_DB_CPUS:?run make bench}
memory: ${BENCH_DB_MEMORY:?run make bench}
memswap_limit: ${BENCH_DB_MEMORY:?run make bench}
valkey:
container_name: mtusi-bench-valkey
restart: "no"
ports: !reset []
deploy:
resources:
limits:
cpus: ${BENCH_CACHE_CPUS:?run make bench}
memory: ${BENCH_CACHE_MEMORY:?run make bench}
memswap_limit: ${BENCH_CACHE_MEMORY:?run make bench}
migrate:
image: mtusi-messenger:bench
# без config.toml рабочего стенда: настройки — окружение и дефолты
volumes: !reset []
api:
# реплики без постоянного имени (оно мешало бы масштабированию):
# оркестратор находит их через docker compose ps, k6 ходит через LB
image: mtusi-messenger:bench
restart: "no"
volumes: !reset []
# healthcheck образа — лишний CPU внутри лимита API; готовность реплик
# проверяет HAProxy (раз в секунду /health/ready)
healthcheck:
disable: true
environment:
# размер 500k с наполнением идёт ~25 мин; на медленном хосте срок
# 3600 с по умолчанию мог бы истечь посреди прогона и дать 401
AUTH__SESSION_TTL_SECONDS: ${BENCH_SESSION_TTL_SECONDS:?run make bench}
deploy:
replicas: ${BENCH_API_REPLICAS:?run make bench}
resources:
limits:
# на каждую реплику
cpus: ${BENCH_APP_CPUS:?run make bench}
memory: ${BENCH_APP_MEMORY:?run make bench}
memswap_limit: ${BENCH_APP_MEMORY:?run make bench}
haproxy:
# один экземпляр: имя нужно оркестратору (статистика, журнал)
container_name: mtusi-bench-haproxy
restart: "no"
# порт рабочего стенда не занимает: k6 в сети стенда
ports: !reset []
deploy:
resources:
limits:
cpus: ${BENCH_LB_CPUS:?run make bench}
memory: ${BENCH_LB_MEMORY:?run make bench}
memswap_limit: ${BENCH_LB_MEMORY:?run make bench}
networks:
default:
# k6 подключается к сети стенда по имени (docker run --network)
name: mtusi-bench