feat: run load bench on PostgreSQL with query plans

- bench stand is a separate compose project mtusi-bench (API, Postgres,
  Valkey) with fixed limits, fresh volume per size and migrations
- k6 registers with a password, logs in with Basic and sends Bearer
- VACUUM (ANALYZE) and CHECKPOINT after prefill
- EXPLAIN (ANALYZE, BUFFERS) of the app's history query via auto_explain,
  plus the same query without the index in a rolled back transaction
- Postgres CPU, table and index size in results; storages in passport
- bench_compare checks storage limits, images and settings
- remove inproc.py and make bench_inproc

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 01:21:15 +03:00
co-authored by Claude Opus 5.5
parent 5582302d68
commit e76eed789f
23 changed files with 2443 additions and 1084 deletions
+9 -19
View File
@@ -3,10 +3,11 @@
Запуск — `make bench_ab BEFORE=<метка> AFTER=<метка> REAPPLY=<commit>`.
В рабочем дереве должен лежать код «до», а изменение — быть
закоммиченным и откаченным отдельным commit; `REAPPLY` — commit отката.
Скрипт снимает стенд и разложение «до», коммитит их, возвращает
изменение (`git revert` commit отката) и снимает «после». Между
прогонами на хосте нет другой работы. Только stdlib. Методика — design
change `perf-bottleneck-fix`, решения 7 и 9.
Скрипт снимает стенд «до», коммитит его результаты, возвращает изменение
(`git revert` commit отката) и снимает «после». Между прогонами на хосте
нет другой работы. Только stdlib. Методика — design change
`perf-bottleneck-fix`, решения 7 и 9; без разложения внутри процесса —
design change `bench-postgres`, решение 8.
"""
import argparse
@@ -35,12 +36,9 @@ def problems(args: argparse.Namespace) -> list[str]:
if not re.fullmatch(r"[A-Za-z0-9._-]+", name or ""):
found.append(f"bad label {name!r}: use [A-Za-z0-9._-]")
continue
for path in (
ROOT / "evidence" / "bench" / name,
ROOT / "evidence" / "profile" / f"{name}.txt",
):
if path.exists():
found.append(f"{path.relative_to(ROOT)} already exists")
path = ROOT / "evidence" / "bench" / name
if path.exists():
found.append(f"{path.relative_to(ROOT)} already exists")
if args.before == args.after:
found.append("BEFORE and AFTER must be different labels")
if git("status", "--porcelain").stdout.strip():
@@ -54,20 +52,12 @@ def problems(args: argparse.Namespace) -> list[str]:
def steps(args: argparse.Namespace) -> list[list[str]]:
# стенд идёт раньше разложения: его dirty считается по всему дереву
return [
["make", "bench", f"BENCH_LABEL={args.before}"],
["make", "bench_inproc", f"BENCH_LABEL={args.before}"],
[
"git",
"add",
f"evidence/bench/{args.before}",
f"evidence/profile/{args.before}.txt",
],
["git", "add", f"evidence/bench/{args.before}"],
["git", "commit", "-m", f"docs: add {args.before} bench evidence"],
["git", "revert", "--no-edit", args.reapply],
["make", "bench", f"BENCH_LABEL={args.after}"],
["make", "bench_inproc", f"BENCH_LABEL={args.after}"],
]