#!/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 # sh bench/track1/series.sh improved # sh bench/track1/series.sh ceiling # ~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 " >&2; exit 2 ;; esac