From 296e070eba2ebb4bf35d35644be100ca5e190e5e Mon Sep 17 00:00:00 2001 From: Artyom Date: Thu, 29 Oct 2026 01:06:49 +0300 Subject: [PATCH] Add the before and after comparison of track 1 make track1-compare builds the image of BEFORE_REV, the last commit without the one-statement write, builds the current one, and runs 8x1 at 3 600, 5 400 and 8 100 rps with the two images alternating per repeat, so drift of the shared VM affects both alike. make track1 runs the host snapshot, both series, the comparison and the plots. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27 --- Makefile | 13 ++++++++++--- openspec/changes/add-lab3-scaling-cost/tasks.md | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1406db32..8259e104 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ FROM_REV ?= SCRIPTS_PY = scripts/probe.py scripts/limits.py scripts/scaling.py tools TRACK1 = evidence/track1 SCALING = $(PYTHON) scripts/scaling.py --fresh-db +BEFORE_REV ?= edc091d PSQL = $(COMPOSE) exec -T postgres psql -U messenger -d messenger -X -q .PHONY: help check validate test load test-persistence test-failover \ @@ -20,7 +21,7 @@ PSQL = $(COMPOSE) exec -T postgres psql -U messenger -d messenger -X -q 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 \ - track1 track1-host track1-a track1-b plots + track1 track1-host track1-a track1-b track1-compare plots help: @echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes" @@ -28,7 +29,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), plots → $(TRACK1)" + @echo "track1 = track1-host, track1-a (1x4/2x2/4x1), track1-b (1x1/2x1/8x1), track1-compare [BEFORE_REV=$(BEFORE_REV)], plots → $(TRACK1)" check: $(PYTHON) scripts/check_contract.py @@ -118,7 +119,7 @@ endif level4: limits lb-check detection failover-each rolling-update -track1: track1-host track1-a track1-b plots +track1: track1-host track1-a track1-b track1-compare plots track1-host: sh scripts/host-snapshot.sh $(TRACK1)/host.txt @@ -131,6 +132,12 @@ track1-b: $(SCALING) --out $(TRACK1)/series-b --configs 1x1,2x1,8x1 --api-memory 512 \ --start-per-cpu 450 --search 1.5:9000 +track1-compare: + git archive "$(BEFORE_REV)" | docker build -q -t mtusi-messenger:before - + $(COMPOSE) build -q api + $(SCALING) --out $(TRACK1)/compare --configs 8x1 --api-memory 512 --rates 3600,5400,8100 \ + --variant before:API_IMAGE=mtusi-messenger:before --variant after + plots: MPLBACKEND=Agg $(UV) run --no-project --python 3.14 --with 'matplotlib==3.11.2' \ python tools/plot_track1.py --out $(TRACK1)/plots $(wildcard $(TRACK1)/*/summary.csv) diff --git a/openspec/changes/add-lab3-scaling-cost/tasks.md b/openspec/changes/add-lab3-scaling-cost/tasks.md index c75a684e..c1528d48 100644 --- a/openspec/changes/add-lab3-scaling-cost/tasks.md +++ b/openspec/changes/add-lab3-scaling-cost/tasks.md @@ -7,7 +7,7 @@ - [x] 2.1 `scripts/docker-stats.sh`, `scripts/lb-stats.sh`, `scripts/pg-stats.sh` (activity, statements, reset, размер базы) - [x] 2.2 `scripts/scaling.py`: конфигурация `RxC` с воркерами, пулом, очередью LB на реплику и закреплением CPU; ожидание ровно R реплик в LB; поиск колена с повторами; варианты «до/после» с чередованием; `summary.csv` и сырьё шага -- [ ] 2.3 `tools/plot_track1.py` и `make plots`; цели `make track1-a`, `track1-b`, `track1-compare`, `track1` +- [x] 2.3 `tools/plot_track1.py` и `make plots`; цели `make track1-a`, `track1-b`, `track1-compare`, `track1` - [x] 2.4 Проверка группы: `make lint`, `make check`, пробный шаг `scaling.py` на одной интенсивности ## 3. Серии