Tie the track tooling to keys, sets and a clean series

reconcile-inject.sh wrote an orphan under a key whose uuid differed
from the id it printed, so the demo could only compare counts; it now
uses one uuid for both, and the dry-run check compares the found and
the injected sets per class. The heal step returns the original bytes
under one quarantined key and random bytes of the same length under
another, and checks that only the first leaves the quarantine. The
load phase sums rechecked over its passes, and a new step stops a pass
hanging on a paused S3 with docker stop and checks exit code 143 within
seconds and a free lock afterwards.

reconcile_track.py cost clears the run files of the previous series and
measures 1k, 10k, 30k and 100k with --deep everywhere. The scenarios
record date, commit and docker inspect of the replicas or of S3 at the
moment they are down. make load-evidence and make clean-clone-evidence
rerun the message load and the clean clone block with raw output, and
make upload-memory passes ARGS to reproduce the run directories.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
Artyom
2026-10-30 09:01:39 +03:00
co-authored by Claude Opus 5.5
parent 3de1dcdc84
commit f1ee385a1b
8 changed files with 241 additions and 34 deletions
+59
View File
@@ -0,0 +1,59 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
runs="${RUNS:-3}"
pause="${PAUSE:-15}"
project=$(docker inspect -f '{{index .Config.Labels "com.docker.compose.project"}}' "$(docker compose ps -q lb)")
network="${project}_edge"
image=$(sed -n 's/^FROM \(python:[^ ]*\) AS runtime$/\1/p' Dockerfile)
name="$project-load-client"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
mkdir -p evidence/load
client() {
docker run --rm --name "$name" --network "$network" --cpus 2 --memory 512m \
--sysctl net.ipv4.tcp_tw_reuse=1 -v "$PWD/tests:/w/tests:ro" -v "$PWD/contracts:/w/contracts:ro" \
-v "$PWD/lab.json:/w/lab.json:ro" -v "$PWD/evidence/load:/out" "$image" python /w/tests/load.py "$@"
}
handled() {
docker compose logs --no-log-prefix --since "$1" api | python3 -c 'import collections, json, sys
seen = collections.Counter()
for line in sys.stdin:
if line.startswith("{"):
event = json.loads(line)
if event.get("event") == "request.handled":
seen[(event["status"], event["method"], event["route"])] += 1
for (status, method, route), count in sorted(seen.items()):
print(status, method, route, count)'
}
{
echo "date: $(date -u +%FT%TZ) commit: $(git rev-parse --short HEAD) network: $network"
echo "# make load-evidence (scripts/load-evidence.sh): закрытый контур tests/load.py, 64 потока, 8 с, все записи"
echo "# прогона в один новый чат, $runs повтора с паузой $pause с; клиент — одноразовый контейнер в сети <проект>_edge"
echo "# стенда (2 CPU, 512 MiB, базовый образ API по digest, tests/, contracts/ и lab.json только для чтения,"
echo "# tcp_tw_reuse=1), адрес http://lb:8080. На 4-й секунде — docker stats; после прогона — request.handled реплик."
echo "\$ docker ps --format '{{.Names}}' | grep -v '^$project-' # чужие контейнеры на VM во время серии"
docker ps --format '{{.Names}}' | grep -v "^$project-" || true
echo "\$ client() { docker run --rm --name $name --network $network --cpus 2 --memory 512m --sysctl net.ipv4.tcp_tw_reuse=1 -v \"\$PWD/tests:/w/tests:ro\" -v \"\$PWD/contracts:/w/contracts:ro\" -v \"\$PWD/lab.json:/w/lab.json:ro\" -v \"\$PWD/evidence/load:/out\" $image python /w/tests/load.py \"\$@\"; }"
run=1
while [ "$run" -le "$runs" ]; do
since=$(date -u +%FT%TZ)
echo "\$ client --base-url http://lb:8080 --duration 8 --concurrency 64 --output /out/run$run.json"
client --base-url http://lb:8080 --duration 8 --concurrency 64 --output "/out/run$run.json" > "$work/out" 2>&1 &
pid=$!
sleep 4
stats=$(docker stats --no-stream --format '{{.Name}} {{.CPUPerc}} {{.MemUsage}}' $(docker compose ps -q) "$name" | sed "s/^$project-//" | sort)
if wait "$pid"; then code=0; else code=$?; fi
echo "exit $code"
cat "$work/out"
echo "\$ docker stats --no-stream # 4-я секунда прогона: контейнер CPU% память"
echo "$stats"
echo "\$ docker compose logs --since $since api | request.handled: статус метод маршрут число"
handled "$since"
[ "$run" -lt "$runs" ] && sleep "$pause"
run=$((run + 1))
done
echo "\$ docker compose exec -T postgres psql -c 'SELECT count(*) FROM messages'"
docker compose exec -T postgres psql -U messenger -d messenger -qAt -c 'SELECT count(*) FROM messages'
} > evidence/load.txt
cat evidence/load.txt