feat(bench): record write latency in preflight queue samples

Co-Authored-By: heihutu <heihutu@gmail.com>
Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com>
This commit is contained in:
Hauser Zhi
2026-12-02 11:34:20 +08:00
parent e0b548fff0
commit ec8bad25b7
3 changed files with 95 additions and 11 deletions
@@ -98,6 +98,8 @@ For a dedicated Linux test cluster, add the following flags to the ABBA command
Repeat the SSH target and device mapping for every node. Specify the Linux kernel device names of the benchmark volumes. With the queue check enabled, each PUT attempt waits for two consecutive rounds of parallel five-second sampling. Each node must have mean queue depth at most 0.25 and no listed device above 0.75. Queue depth uses the change in weighted I/O milliseconds divided by elapsed monotonic milliseconds. Each attempt records the collected samples in its cell's `node_telemetry/queue_*.tsv`. An unavailable node, invalid counter or timeout fails the attempt before Warp starts. The ABBA drift and regression budgets still apply. [Linux block device counters](https://docs.kernel.org/admin-guide/iostats.html)
The queue TSV also records `completed_writes`, `write_ms_per_op`, and `peak_write_ms_per_op` for the same samples. Write latency divides the change in milliseconds spent writing by the change in completed writes. The node average is weighted by completed writes, and the peak is the highest per-device average among devices with write completions. A window with no completed writes reports zero completions and `NA` for both latency fields. Compare the last two samples of successful attempts across legs to check for different write completion behavior at similarly low queue depths. These fields are diagnostic and the existing queue and drift thresholds still apply.
Use the same persistent lock file for cooperating commands on the same controller. An occupied lock makes the runner exit before deployment. Keep the lock file in place so every command locks the same inode. The controller runs the restore hook once after any deployment attempt, including a failed deploy, interrupted workload or failed gate. The hook receives `HOTPATH_ABBA_DATASET_NAMESPACE` and `HOTPATH_ABBA_OUT_DIR`. It owns the site-specific cleanup and must reconcile partially completed remote deployment, restore services and verify readiness before returning. Use bounded, synchronous hooks on the controller. The runner stops the active controller process group before restoration, holds the lock through restoration and records `restore.log` and `restore.status`. Managed runs require `flock` and a `timeout` implementation supporting `--foreground` and `--kill-after`.
For diagnostic PUT runs using `--service-prometheus-query-url`, add `--require-rename-rank-metrics` after enabling PUT stage metrics and warming that deployment. The service snapshots must include `rustfs_s3_put_object_rename_disk_wait_completion_ms_count` for both `position="quorum_first"` and `position="quorum_tail"`. Each group must advance across the attempt without series resets or changes in membership. Use the existing query or service-name filter to scope snapshots to the benchmark service. These counters describe completion order. Per-request attribution also needs a join with the coordinator's ACK decision.
+56 -2
View File
@@ -286,18 +286,48 @@ marker="$GUARD_DIR/$host"
case "${QUEUE_FIXTURE:-quiet}" in
missing) exit 2 ;;
hung) exec sleep 60 ;;
diskstats-*)
QUEUE_SAMPLE_DIR="$(mktemp -d "$GUARD_DIR/diskstats.XXXXXXXX")"
export QUEUE_SAMPLE_DIR
trap 'rm -rf -- "$QUEUE_SAMPLE_DIR"' EXIT
printf '10.00 0.00\n' >"$QUEUE_SAMPLE_DIR/uptime"
cat >"$QUEUE_SAMPLE_DIR/diskstats" <<'STATS'
259 0 nvme0n1 0 0 0 0 20 0 80 40 0 0 100
259 1 nvme1n1 0 0 0 0 30 0 80 60 0 0 100
STATS
cp "$QUEUE_SAMPLE_DIR/diskstats" "$QUEUE_SAMPLE_DIR/after"
if [[ "$QUEUE_FIXTURE" != diskstats-idle ]]; then
writes=24
write_ms=48
case "$QUEUE_FIXTURE" in
diskstats-reset-count) writes=19 ;;
diskstats-reset-time) write_ms=39 ;;
esac
printf '259 0 nvme0n1 0 0 0 0 %s 0 96 %s 0 0 250\n' "$writes" "$write_ms" >"$QUEUE_SAMPLE_DIR/after"
printf '259 1 nvme1n1 0 0 0 0 46 0 128 76 0 0 150\n' >>"$QUEUE_SAMPLE_DIR/after"
fi
advance_diskstats() {
printf '15.00 0.00\n' >"$QUEUE_SAMPLE_DIR/uptime"
cp "$QUEUE_SAMPLE_DIR/after" "$QUEUE_SAMPLE_DIR/diskstats"
}
export -f advance_diskstats
command=$(printf '%s\n' "$command" | sed \
's@/proc/uptime@"$QUEUE_SAMPLE_DIR/uptime"@g; s@/proc/diskstats@"$QUEUE_SAMPLE_DIR/diskstats"@g; s@^sleep 5$@advance_diskstats@')
bash -c "$command"
exit
;;
reset)
n=0
[[ ! -f "$marker" ]] || read -r n < "$marker"
n=$((n+1))
printf '%s\n' "$n" > "$marker"
if [[ "$host" == host-b && "$n" == 2 ]]; then
echo '0.050000 0.800000'
echo '0.050000 0.800000 0 NA NA'
exit 0
fi
;;
esac
echo '0.050000 0.070000'
echo '0.050000 0.070000 0 NA NA'
SSH
cat > "$GUARD_BIN/curl" <<'CURL'
#!/usr/bin/env bash
@@ -369,4 +399,28 @@ if PATH="$GUARD_BIN:$PATH" QUEUE_FIXTURE=hung "$SCRIPT_DIR/wait_cluster_disk_que
fi
rg -q 'failed or timed out' "$TMP_DIR/queue-timeout.log"
queue_cmd=("$SCRIPT_DIR/wait_cluster_disk_queue.sh"
--target a=host-a --devices a=nvme0n1+nvme1n1 --timeout-secs 11)
for fixture in diskstats-write diskstats-idle; do
PATH="$GUARD_BIN:$PATH" QUEUE_FIXTURE="$fixture" "${queue_cmd[@]}" >"$TMP_DIR/$fixture.tsv"
printf 'sample\tnode\tmean_queue\tpeak_queue\tcompleted_writes\twrite_ms_per_op\tpeak_write_ms_per_op\n' >"$TMP_DIR/expected.tsv"
for sample in 1 2; do
if [[ "$fixture" == diskstats-write ]]; then
printf '%s\ta\t0.020000\t0.030000\t20\t1.200000\t2.000000\n' "$sample"
else
printf '%s\ta\t0.000000\t0.000000\t0\tNA\tNA\n' "$sample"
fi
done >>"$TMP_DIR/expected.tsv"
diff -u "$TMP_DIR/expected.tsv" "$TMP_DIR/$fixture.tsv"
done
for fixture in diskstats-reset-count diskstats-reset-time; do
if PATH="$GUARD_BIN:$PATH" QUEUE_FIXTURE="$fixture" "${queue_cmd[@]}" >"$TMP_DIR/$fixture.log" 2>&1; then
echo "expected $fixture to fail an otherwise quiet sample" >&2
exit 1
fi
rg -q 'disk queue sample failed or timed out' "$TMP_DIR/$fixture.log"
done
echo "object batch benchmark enhanced tests passed"
+37 -9
View File
@@ -73,6 +73,7 @@ trap 'exit 143' TERM
# Only validated device names are placed in the SSH command. The sampler uses
# monotonic uptime and the weighted I/O milliseconds from /proc/diskstats.
# Write completions and write milliseconds describe the same sampling window.
sample=$(cat <<'REMOTE'
set -eu
export LC_ALL=C
@@ -81,8 +82,8 @@ snapshot() {
BEGIN { n=split(devices,d," "); for(i=1;i<=n;i++) want[d[i]]=1 }
FNR==NR { t=$1; next }
$3 in want {
if (NF<14 || $14 !~ /^[0-9]+$/) exit 2
print $3,t,$14
if (NF<14 || $8 !~ /^[0-9]+$/ || $11 !~ /^[0-9]+$/ || $14 !~ /^[0-9]+$/) exit 2
print $3,t,$14,$8,$11
got++
}
END { if (got!=n) exit 2 }
@@ -93,10 +94,36 @@ sleep 5
after=$(snapshot)
printf '%s\n--\n%s\n' "$before" "$after" | awk '
$0=="--" { second=1; next }
!second { if ($1 in t) bad=1; t[$1]=$2; w[$1]=$3; count++; next }
{ if (!($1 in t) || seen[$1]++ || $2<=t[$1] || $3<w[$1]) { bad=1; next }
q=($3-w[$1])/(1000*($2-t[$1])); sum+=q; if(q>peak)peak=q; got++ }
END { if (bad||!count||got!=count) exit 2; printf "%.6f %.6f\n",sum/count,peak }
!second {
if ($1 in t) bad=1
t[$1]=$2; w[$1]=$3; writes[$1]=$4; write_ms[$1]=$5
count++
next
}
{
if (!($1 in t) || seen[$1]++ || $2<=t[$1] || $3<w[$1] || $4<writes[$1] || $5<write_ms[$1]) {
bad=1
next
}
q=($3-w[$1])/(1000*($2-t[$1]))
sum+=q
if (q>peak) peak=q
completed=$4-writes[$1]
if (completed>0) {
elapsed_ms=$5-write_ms[$1]
total_completed+=completed
total_write_ms+=elapsed_ms
await_ms=elapsed_ms/completed
if (await_ms>peak_write_ms) peak_write_ms=await_ms
}
got++
}
END {
if (bad||!count||got!=count) exit 2
printf "%.6f %.6f %.0f",sum/count,peak,total_completed
if (total_completed>0) printf " %.6f %.6f\n",total_write_ms/total_completed,peak_write_ms
else printf " NA NA\n"
}
'
REMOTE
)
@@ -104,7 +131,7 @@ REMOTE
end=$((SECONDS+budget))
streak=0
sample_number=0
printf 'sample\tnode\tmean_queue\tpeak_queue\n'
printf 'sample\tnode\tmean_queue\tpeak_queue\tcompleted_writes\twrite_ms_per_op\tpeak_write_ms_per_op\n'
while ((end-SECONDS >= 5)); do
sample_number=$((sample_number+1))
remaining=$((end-SECONDS))
@@ -125,12 +152,13 @@ while ((end-SECONDS >= 5)); do
quiet=true
for i in "${!targets[@]}"; do
result=$(cat "$artifacts/$i")
if [[ ! "$result" =~ ^([0-9]+\.[0-9]+)\ ([0-9]+\.[0-9]+)$ ]]; then
if [[ ! "$result" =~ ^([0-9]+\.[0-9]+)\ ([0-9]+\.[0-9]+)\ ([0-9]+)\ (NA|[0-9]+\.[0-9]+)\ (NA|[0-9]+\.[0-9]+)$ ]]; then
echo "invalid disk queue sample from ${targets[i]%%=*}" >&2; exit 1
fi
mean="${BASH_REMATCH[1]}"
peak="${BASH_REMATCH[2]}"
printf '%s\t%s\t%s\t%s\n' "$sample_number" "${targets[i]%%=*}" "$mean" "$peak"
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$sample_number" "${targets[i]%%=*}" "$mean" "$peak" \
"${BASH_REMATCH[3]}" "${BASH_REMATCH[4]}" "${BASH_REMATCH[5]}"
if ! awk -v mean="$mean" -v peak="$peak" 'BEGIN {exit !(mean<=0.25 && peak<=0.75)}'; then quiet=false; fi
done
if [[ "$quiet" == true ]]; then