forked from mtusi2026/mtusi2026lab3
Pin the timeout chain in the stand and test it
The API service now names every timeout that the chain depends on: DRAIN_SECONDS, DB_ACQUIRE_TIMEOUT_SECONDS and DB_COMMAND_TIMEOUT_SECONDS join REQUEST_TIMEOUT_SECONDS and SHUTDOWN_TIMEOUT_SECONDS in compose, and the image gets the drain default. A unit test reads the compose defaults, the HAProxy check and timeout settings and the stop hook timeout, and checks that the chain shrinks inwards: LB server 10 s > request 8 s > pool wait plus statement 3 s, readiness 0.8 s < check 1 s, drain 2 s > worst detection 1.5 s, shutdown 5 s leaves 3 s for accepted requests, and shutdown < hook 6 s < stop_grace_period 8 s < 10 s. It also pins the declared detection maxima: 1.5 s for a 503 or a refused connection and 3.5 s for a hung replica. The k6 load generator joins the stand under the bench profile: pinned by digest, edge network only, 2 CPU and 512 MiB, no secrets. 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
6fb4587ef6
commit
85ed37914d
@@ -42,6 +42,9 @@ services:
|
||||
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-2}
|
||||
DB_POOL_MAX_SIZE: ${DB_POOL_MAX_SIZE:-8}
|
||||
REQUEST_TIMEOUT_SECONDS: ${REQUEST_TIMEOUT_SECONDS:-8}
|
||||
DB_ACQUIRE_TIMEOUT_SECONDS: ${DB_ACQUIRE_TIMEOUT_SECONDS:-1}
|
||||
DB_COMMAND_TIMEOUT_SECONDS: ${DB_COMMAND_TIMEOUT_SECONDS:-2}
|
||||
DRAIN_SECONDS: ${DRAIN_SECONDS:-2}
|
||||
SHUTDOWN_TIMEOUT_SECONDS: ${SHUTDOWN_TIMEOUT_SECONDS:-5}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||
secrets: [database_url, cache_url, cursor_secret]
|
||||
@@ -149,6 +152,17 @@ services:
|
||||
resources:
|
||||
limits: {cpus: "0.5", memory: 128m}
|
||||
|
||||
k6:
|
||||
image: grafana/k6:2.3.0@sha256:2dd4756ec6e14e62778916e1eb850108e4b499304c02df56760fa0bdb0fba0b8
|
||||
profiles: [bench]
|
||||
environment:
|
||||
BASE_URL: http://lb:8080
|
||||
volumes: [./infra/k6:/scripts:ro]
|
||||
networks: [edge]
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "${K6_CPUS:-2}", memory: "${K6_MEMORY:-512m}"}
|
||||
|
||||
secrets:
|
||||
postgres_password:
|
||||
file: ./secrets/postgres_password
|
||||
|
||||
Reference in New Issue
Block a user