Add the series orchestrator and samplers for track 1

scripts/scaling.py applies a replicas x CPU layout through compose
variables: workers equal to the replica CPUs, a pool of 8 per worker,
a balancer queue of 32 per worker so every layout of a series offers
the same concurrency to the API, and the replicas pinned to CPUs 7 and
up, next to PostgreSQL on 0-1, the balancer on 2, Valkey on 3 and k6
on 4-6 with 3 CPU and 1 GiB. For every offered rate it runs k6 three
times and stops a config after two steps saturated in all repeats.

Each step keeps its raw data: k6 summary, docker stats, HAProxy
statistics and pg_stat_activity sampled every second, and the top of
pg_stat_statements. The summary row carries CPU per component,
PostgreSQL active, idle, idle in transaction and lock waiting backends,
the balancer queue and the database size. Several variants alternate
per repeat for before and after runs. host-snapshot.sh records every
container on the host before a series.

make track1-a and track1-b run the fixed budget and the growth series
from an empty database.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Artyom
2026-10-28 20:25:23 +03:00
co-authored by Claude Opus 5.5
parent 107fbbbe15
commit 8ea1996063
8 changed files with 419 additions and 5 deletions
+17 -2
View File
@@ -10,14 +10,17 @@ COMPOSE ?= docker compose
RATE ?= 100
API_IMAGE ?= mtusi-messenger:lab3
FROM_REV ?=
SCRIPTS_PY = scripts/probe.py scripts/limits.py
SCRIPTS_PY = scripts/probe.py scripts/limits.py scripts/scaling.py
TRACK1 = evidence/track1
SCALING = $(PYTHON) scripts/scaling.py --fresh-db --start-per-cpu 150
PSQL = $(COMPOSE) exec -T postgres psql -U messenger -d messenger -X -q
.PHONY: help check validate test load test-persistence test-failover \
install lint format typecheck student-test \
secrets up down reset-data migrate ps logs restore lb-check failover-evidence stack-evidence \
persistence-evidence storage-evidence cache-evidence test-faults seed explain \
limits detection failover-each rolling-update level4
limits detection failover-each rolling-update level4 \
track1 track1-host track1-a track1-b
help:
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
@@ -25,6 +28,7 @@ help:
@echo "secrets/up/down/migrate/ps/logs: стенд Docker Compose; reset-data: намеренное удаление volumes"
@echo "restore: вернуть остановленные реплики; lb-check: реплики на одном токене и 20 гонок одного ключа"
@echo "level4 = limits, lb-check, detection, failover-each, rolling-update [FROM_REV=<коммит>]; RATE=$(RATE) rps"
@echo "track1 = track1-host, track1-a (1x4/2x2/4x1), track1-b (1x1/2x1/8x1) → $(TRACK1)"
check:
$(PYTHON) scripts/check_contract.py
@@ -114,6 +118,17 @@ endif
level4: limits lb-check detection failover-each rolling-update
track1: track1-host track1-a track1-b
track1-host:
sh scripts/host-snapshot.sh $(TRACK1)/host.txt
track1-a:
$(SCALING) --out $(TRACK1)/series-a --configs 1x4,2x2,4x1 --api-memory-total 2048
track1-b:
$(SCALING) --out $(TRACK1)/series-b --configs 1x1,2x1,8x1 --api-memory 512
failover-evidence:
sh scripts/failover-evidence.sh "$(BASE_URL)"