Files
mtusi2026lab3/bench/track1/series.sh
T
Alexey BodanyukandClaude Opus 5.5 479cd78f7f bench: трек 1 — серия D (A/B multi vs function, 3 повтора), план серии E
Образ коммита 4830be4, одна переменная MESSAGE_WRITE_PATH:
2x1.0 CPU / БД 2.0 — 283 -> 489 успешных/с (function не насыщен на сетке
до 500/с); 3x1.0 / БД 0.5 — 202 -> 452 успешных/с; SQL-операторов на
сообщение 15.4 -> 3.0. Серия E (ceiling) — поиск потолка нового пути.
Профили py-spy после серии не запустились (series.sh правился во время
выполнения), запускаются отдельно.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:08:49 +03:00

45 lines
2.7 KiB
Bash
Executable File

#!/bin/sh
# The exact track 1 experiment plan (REPORT.md, "Трек 1"). Every series starts fresh stands and
# measures the API image built from the given commit. Stop the main stand first (CPU noise):
# docker compose stop
# sh bench/track1/series.sh baseline <commit-before-the-improvement>
# sh bench/track1/series.sh improved <commit-with-the-improvement>
# sh bench/track1/series.sh ceiling <commit-with-the-improvement>
# ~2.5 h for `baseline`, ~1.5 h for `improved` on the reference laptop (see meta.json files).
set -eu
cd "$(dirname "$0")/../.."
PY="${PYTHON:-$(command -v python3 || command -v python)}"
phase="${1:?baseline, improved or ceiling}"
ref="${2:-HEAD}"
run() { "$PY" bench/track1/run.py --git-ref "$ref" --repeats "${REPEATS:-3}" "$@"; }
case "$phase" in
baseline)
# A. Fixed total API budget 2.0 CPU / 768 MiB split into 1, 2, 4 replicas; PostgreSQL 2.0 CPU.
run --series A-fixed-total --label baseline --rates 100,150,200,250,300,350 \
--config replicas=1,api_cpus=2.0,api_memory=768m \
--config replicas=2,api_cpus=1.0,api_memory=384m \
--config replicas=4,api_cpus=0.5,api_memory=192m
# B. Growing API resources (1, 2, 3 replicas x 1.0 CPU) against a NARROW database (0.5 CPU).
run --series B-replicas-vs-db --label baseline --rates 100,150,200,250,300,350,400 \
--config replicas=1,pg_cpus=0.5 --config replicas=2,pg_cpus=0.5 --config replicas=3,pg_cpus=0.5
# C. Growing database resources (0.5 -> 1.0 -> 2.0 CPU) at 3 API replicas: does the ceiling move?
run --series C-db-growth --label baseline --rates 200,250,300,350,400,450,500 \
--config replicas=3,pg_cpus=1.0 --config replicas=3,pg_cpus=2.0
;;
improved)
# D. The improvement (single-round-trip write) against the old write path on the SAME image,
# in the API-bound (2 x 1.0, PG 2.0) and the DB-bound (3 x 1.0, PG 0.5) configurations.
run --series D-improvement --label "$ref" --rates 150,200,250,300,350,400,450,500 \
--config replicas=2,MESSAGE_WRITE_PATH=multi --config replicas=2,MESSAGE_WRITE_PATH=function \
--config replicas=3,pg_cpus=0.5,MESSAGE_WRITE_PATH=multi --config replicas=3,pg_cpus=0.5,MESSAGE_WRITE_PATH=function
;;
ceiling)
# E. Series D showed the function path NOT saturated at 500/s with 2 x 1.0: find its ceiling
# (same configurations, higher rates) and where the bottleneck moves to.
run --series E-improved-ceiling --label "$ref" --rates 450,550,650,750,850 \
--config replicas=2,MESSAGE_WRITE_PATH=function --config replicas=3,pg_cpus=0.5,MESSAGE_WRITE_PATH=function
;;
*) echo "usage: series.sh baseline|improved|ceiling <git-ref>" >&2; exit 2 ;;
esac