Добавить генератор нагрузки, сбор метрик реплик и сценарии экспериментов для отказов, rolling update и трека 1
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
# Level 4: a rolling update under a constant write load. The generator sends
|
||||
# messages at RATE for DURATION, retrying uncertain sends with the same key;
|
||||
# at UPDATE_AT seconds `scripts/rollout.sh` replaces every replica. Afterwards
|
||||
# the generator reads the history back: every confirmed message once.
|
||||
#
|
||||
# sh scripts/bench/rollout-under-load.sh
|
||||
#
|
||||
# Environment: RATE (50), DURATION (60s), UPDATE_AT (15), OUT (default
|
||||
# evidence/rollout). Results in <OUT>/: timeline.json, seconds.csv,
|
||||
# rollout.log, update.json (when it ran), compose.log, instances-*.txt.
|
||||
set -eu
|
||||
cd "$(dirname "$0")/../.."
|
||||
. scripts/bench/lib.sh
|
||||
|
||||
rate=${RATE:-50}
|
||||
duration=${DURATION:-60s}
|
||||
update_at=${UPDATE_AT:-15}
|
||||
dir=${OUT:-evidence/rollout}
|
||||
export MSYS_NO_PATHCONV=1
|
||||
|
||||
rm -rf "$dir"
|
||||
mkdir -p "$dir"
|
||||
docker compose up -d --wait >/dev/null 2>&1
|
||||
# Build first, as a delivery pipeline would: the update under load then
|
||||
# measures the replacement of the replicas, not the compiler.
|
||||
docker compose build api >/dev/null 2>&1
|
||||
meta "$dir/meta.json" "experiment=rolling-update" "rate=$rate" "duration=$duration" "update_at_s=$update_at"
|
||||
sh scripts/instances.sh >"$dir/instances-before.txt"
|
||||
since=$(date -u +%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=$!
|
||||
sleep "$update_at"
|
||||
started=$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)
|
||||
status=0
|
||||
sh scripts/rollout.sh >"$dir/rollout.log" 2>&1 || status=$?
|
||||
finished=$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)
|
||||
wait "$generator" || echo "generator reported a failed history check, see $dir/loadgen.log"
|
||||
|
||||
printf '{\n "update_started_utc": "%s",\n "update_finished_utc": "%s",\n "rollout_exit_code": %s\n}\n' \
|
||||
"$started" "$finished" "$status" >"$dir/update.json"
|
||||
docker compose logs --no-color --since "$since" lb api migrate >"$dir/compose.log" 2>&1
|
||||
sh scripts/instances.sh >"$dir/instances-after.txt"
|
||||
cat "$dir/loadgen.log" | tail -n 1
|
||||
echo "results in $dir"
|
||||
Reference in New Issue
Block a user