Доработать инструменты экспериментов: чередовать повторы, останавливать лестницу на первой проваленной ступени, задавать maxconn и CPU базы в сериях, записывать замер скорости хоста и контроль шума, сократить комментарии

This commit is contained in:
2026-11-04 12:39:04 +03:00
parent ce47c138e4
commit baa5995938
24 changed files with 253 additions and 240 deletions
+7 -21
View File
@@ -1,26 +1,14 @@
#!/bin/sh
# Level 4: one API replica fails under a constant write load. The generator
# sends messages at RATE for DURATION and retries uncertain sends with the
# same key; at FAULT_AT seconds the chosen replica is stopped (stop: SIGTERM,
# graceful) or killed (kill: SIGKILL, a crash), at RESTORE_AT it is started
# again. Afterwards the generator reads the history back: every confirmed
# message once.
# Level 4: one replica stopped (SIGTERM) or killed (SIGKILL) at FAULT_AT and
# started again at RESTORE_AT, under a constant write load that retries
# uncertain sends with the same key; then every confirmed message must be in
# the history once.
#
# sh scripts/bench/failover.sh stop|kill <replica number, 1-based>
#
# Environment: RATE (50), DURATION (60s), FAULT_AT (15), RESTORE_AT (35),
# OUT (default evidence/failover). Results in <OUT>/<kind>-<n>/:
# timeline.json, seconds.csv (per-second outcomes, attributed by send time),
# faults.json (when and what was stopped), compose.log (the balancer's
# DOWN/UP lines and the replicas' shutdown/start lines), instances-*.txt.
# Runs on the current stand (`make up`) and leaves every replica running.
#
# Every time used for the analysis comes from the Docker VM's clock: the log
# timestamps, the container's stop and start times from `docker inspect`, and
# the generator's own times. The host clock of Windows runs apart from it by
# a fraction of a second, a large share of a 1.5 s detection window; host
# times are kept for reference only. With `stop`, the moment SIGTERM arrived
# is the replica's own "shutdown started" line in compose.log.
# Environment: RATE (50), DURATION (60s), FAULT_AT (15), RESTORE_AT (35), OUT
# (evidence/failover). Times come from the Docker VM clock; the Windows clock
# differs by a fraction of a second and is kept for reference only.
set -eu
cd "$(dirname "$0")/../.."
. scripts/bench/lib.sh
@@ -50,8 +38,6 @@ since=$(date -u -d '-10 seconds' +%Y-%m-%dT%H:%M:%SZ)
BENCH_OUT=$(abspath "$dir") docker compose --profile bench run --rm loadgen timeline \
-rate "$rate" -duration "$duration" >"$dir/loadgen.log" 2>&1 &
generator=$!
# The generator seeds two users first; its timeline starts after that. The
# fault times below are absolute, as is started_at in timeline.json.
sleep "$fault_at"
fault_host=$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)
docker "$kind" "$target" >/dev/null