peppa/bench/sqlite/matrix.sh
Асель 50b1d1afec PEP-36: benchmark SQLite vs Postgres and propose Bun + SQLite stack
bench/sqlite (outside the workspace): Peppa-like load with 10/20 runners,
a hook process per event, MCP, bot, web and watchdog; bun:sqlite,
node:sqlite, better-sqlite3, a single-writer service and Postgres; notify
replacements (cursor polling, fs.watch on WAL, unix-socket push); a
ceiling test; a schema port to sqlite with a data copy from Postgres and
a check of drizzle transactions.

openspec/changes/pep-36-lightweight-stack: proposal, design with the
numbers, specs (platform-storage, service-monitoring), phased tasks.
No product code changes; the move waits for the PM's decision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:28:59 +05:00

33 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Full PEP-36 matrix. BENCH_PG_URL must point at the throwaway peppa_bench database.
# BENCH_PG_URL=postgres://…/peppa_bench ./matrix.sh [smoke]
set -u
cd "$(dirname "$0")"
DUR1=${DUR1:-90}; DUR10=${DUR10:-60}
run() { node run.ts "$@" 2>&1 | grep -vE "^\[bench\]"; }
if [ "${1:-}" = smoke ]; then
for b in "--backend bun --notify push" "--backend writer --notify push" "--backend node --notify fswatch" "--backend pg"; do
run $b --runners 3 --load 5 --duration 12 --name smoke | grep -E "==|write ALL|deliver|rror"
done
exit
fi
# 1. Write contention: every backend at 10/20 runners, real load (x1) and x10.
for r in 10 20; do
for x in 1 10; do
d=$([ $x = 1 ] && echo $DUR1 || echo $DUR10)
run --backend bun --runners $r --load $x --duration $d --notify poll:1000
run --backend node --runners $r --load $x --duration $d --notify poll:1000
run --backend better --runners $r --load $x --duration $d --notify poll:1000
run --backend writer --runners $r --load $x --duration $d --notify push
run --backend pg --runners $r --load $x --duration $d --notify pg
done
done
# 2. LISTEN/NOTIFY replacements on bun:sqlite, 20 runners x10.
for n in poll:200 poll:1000 fswatch push; do
run --backend bun --runners 20 --load 10 --duration $DUR10 --notify $n
done
# 3. Saturation: 20 runners at x50 (≈ 100 hook processes/s) — where does each one bend?
for b in "--backend bun --notify poll:1000" "--backend writer --notify push" "--backend pg --notify pg"; do
run $b --runners 20 --load 50 --duration 45
done