mirror of
https://github.com/rustfs/rustfs.git
synced 2026-12-02 22:26:21 +00:00
ba453ce15e
Co-authored-by: heihutu <heihutu@gmail.com> Co-authored-by: zhi22915 <qiuzgang@gmail.com> Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
373 lines
12 KiB
Bash
Executable File
373 lines
12 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
RUNNER="${SCRIPT_DIR}/run_object_batch_bench_enhanced.sh"
|
|
TMP_DIR="$(mktemp -d)"
|
|
OUT_DIR="${TMP_DIR}/run"
|
|
|
|
cleanup() {
|
|
rm -rf "$TMP_DIR"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
"$RUNNER" \
|
|
--tool warp \
|
|
--endpoint http://127.0.0.1:9000 \
|
|
--access-key test-access \
|
|
--secret-key test-secret \
|
|
--sizes 1MiB \
|
|
--rounds 1 \
|
|
--retry-per-round 1 \
|
|
--cooldown-secs 0 \
|
|
--duration 1s \
|
|
--out-dir "$OUT_DIR" \
|
|
--warp-bin true \
|
|
--warp-mode put \
|
|
--dry-run \
|
|
--after-probe \
|
|
--service-metrics-dir "${OUT_DIR}/metrics" \
|
|
--server-image-ref rustfs/rustfs:bench \
|
|
--server-image-digest sha256:0123456789abcdef \
|
|
--server-revision 9f61bad94 \
|
|
--require-server-provenance \
|
|
--label topology=4x2 \
|
|
--label workload=get \
|
|
--node-metrics-url node1=http://127.0.0.1:9001/metrics \
|
|
--node-ssh-target node1=localhost \
|
|
--node-ssh-identity-file /tmp/nonexistent-key \
|
|
--node-ssh-timeout-secs 7 \
|
|
--require-node-telemetry \
|
|
--storage-quiescence-container rustfs-bench-1 \
|
|
--storage-quiescence-docker-context test-context \
|
|
--storage-quiescence-consecutive 3 \
|
|
--storage-quiescence-timeout-secs 9 \
|
|
--storage-quiescence-interval-secs 2 \
|
|
--node-docker-container node1=rustfs-bench-1 >/dev/null
|
|
|
|
rg -qx 'server_image_ref=rustfs/rustfs:bench' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'server_image_digest=sha256:0123456789abcdef' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'server_revision=9f61bad94' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'warp_report_operation=PUT' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'run_label_topology=4x2' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'run_label_workload=get' "${OUT_DIR}/run_manifest.env"
|
|
rg -q '^node1,rustfs-bench-1,not_run_dry_run,N/A,N/A,N/A,N/A$' "${OUT_DIR}/node_inventory.csv"
|
|
rg -q '^1MiB,warp,1,1,before,node1,not_run_dry_run,' "${OUT_DIR}/node_metrics_captures.csv"
|
|
rg -q '^1MiB,warp,1,1,after,node1,rustfs-bench-1,not_run_dry_run,' "${OUT_DIR}/node_resource_captures.csv"
|
|
rg -qx 'after_probe=true' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'node_ssh_identity_file=/tmp/nonexistent-key' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'node_ssh_timeout_secs=7' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'require_node_telemetry=true' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'storage_quiescence_container=rustfs-bench-1' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'storage_quiescence_docker_context=test-context' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'storage_quiescence_consecutive=3' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'storage_quiescence_timeout_secs=9' "${OUT_DIR}/run_manifest.env"
|
|
rg -qx 'storage_quiescence_interval_secs=2' "${OUT_DIR}/run_manifest.env"
|
|
rg -q '^1MiB,warp,1,1,before,node1,localhost,not_run_dry_run,' "${OUT_DIR}/node_telemetry_captures.csv"
|
|
rg -q '^1MiB,warp,1,1,not_run_dry_run,rustfs-bench,N/A,1048576,N/A,N/A,N/A,N/A,N/A,dry_run$' "${OUT_DIR}/after_probe.csv"
|
|
|
|
"$RUNNER" \
|
|
--tool warp \
|
|
--endpoint http://127.0.0.1:9000 \
|
|
--access-key test-access \
|
|
--secret-key test-secret \
|
|
--sizes 1MB \
|
|
--rounds 1 \
|
|
--retry-per-round 1 \
|
|
--cooldown-secs 0 \
|
|
--duration 1s \
|
|
--out-dir "${TMP_DIR}/decimal-size" \
|
|
--warp-bin true \
|
|
--warp-mode put \
|
|
--dry-run \
|
|
--after-probe >/dev/null
|
|
rg -q '^1MB,warp,1,1,not_run_dry_run,rustfs-bench,N/A,1000000,N/A,N/A,N/A,N/A,N/A,dry_run$' "${TMP_DIR}/decimal-size/after_probe.csv"
|
|
|
|
if "$RUNNER" \
|
|
--tool warp \
|
|
--endpoint http://127.0.0.1:9000 \
|
|
--access-key test-access \
|
|
--secret-key test-secret \
|
|
--warp-bin true \
|
|
--dry-run \
|
|
--require-server-provenance >/dev/null 2>&1; then
|
|
echo "expected --require-server-provenance to reject missing identity" >&2
|
|
exit 1
|
|
fi
|
|
|
|
"$RUNNER" \
|
|
--tool warp \
|
|
--endpoint http://127.0.0.1:9000 \
|
|
--access-key test-access \
|
|
--secret-key test-secret \
|
|
--sizes 1MiB \
|
|
--rounds 1 \
|
|
--retry-per-round 1 \
|
|
--cooldown-secs 0 \
|
|
--out-dir "${TMP_DIR}/default" \
|
|
--warp-bin true \
|
|
--dry-run >/dev/null
|
|
|
|
rg -qx 'run_label_count=0' "${TMP_DIR}/default/run_manifest.env"
|
|
|
|
if "$RUNNER" \
|
|
--tool warp \
|
|
--endpoint http://127.0.0.1:9000 \
|
|
--access-key test-access \
|
|
--secret-key test-secret \
|
|
--warp-bin true \
|
|
--dry-run \
|
|
--storage-quiescence-container rustfs-bench-1 >/dev/null 2>&1; then
|
|
echo "expected incomplete quiescence configuration to fail" >&2
|
|
exit 1
|
|
fi
|
|
|
|
FAKE_WARP="${TMP_DIR}/fake-warp"
|
|
cat >"$FAKE_WARP" <<'EOF'
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
[[ " $* " == *" --analyze.v "* ]]
|
|
[[ " $* " == *" --no-color "* ]]
|
|
if [[ "${FAKE_WARP_ZERO_LATENCY:-0}" == "1" ]]; then
|
|
cat <<'LOG'
|
|
Operation: PUT. Concurrency: 8. Ran: 7s
|
|
Requests considered: 1000:
|
|
* Average: 160.00 MiB/s, 40960.00 obj/s
|
|
* Avg: 0s, 50%: 0s, 90%: 0s, 99%: 0s, Fastest: 0s, Slowest: 1ms, StdDev: 0s
|
|
LOG
|
|
exit 0
|
|
fi
|
|
cat <<'LOG'
|
|
- PUT Average: 161 Obj/s, 5.0MiB/s; Current 161 Obj/s, 5.0MiB/s.
|
|
Operation: DELETE - total: 100, 10.0%, Concurrency: 8, Ran 7s
|
|
* Throughput: 11.00 obj/s
|
|
Requests considered: 100:
|
|
* Avg: 100ms, 50%: 50ms, 90%: 150ms, 99%: 200ms, Fastest: 1ms, Slowest: 300ms, StdDev: 20ms
|
|
Operation: GET. Concurrency: 64. Ran: 7s
|
|
Requests considered: 1000:
|
|
* Average: 653.90 MiB/s, 20925.58 obj/s
|
|
* Avg: 3.5ms, 50%: 2.0ms, 90%: 3.6ms, 99%: 24.1ms, Fastest: 0.2ms, Slowest: 607.7ms, StdDev: 20.6ms
|
|
Operation: PUT - total: 300, 15.0%, Size: 32767 bytes. Concurrency: 8, Ran 7s
|
|
* Throughput: 63.53 MiB/s, 254.13 obj/s
|
|
Requests considered: 300:
|
|
* Avg: 18ms, 50%: 3ms, 90%: 58ms, 99%: 216ms, Fastest: 2ms, Slowest: 608ms, StdDev: 45ms
|
|
Operation: STAT - total: 600, 30.0%, Concurrency: 8, Ran 7s
|
|
* Throughput: 508.42 obj/s
|
|
Requests considered: 600:
|
|
* Avg: 0s, 50%: 0s, 90%: 1ms, 99%: 1ms, Fastest: 0s, Slowest: 150ms, StdDev: 3ms
|
|
LOG
|
|
case "${FAKE_WARP_ERRORS:-}" in
|
|
spaced) echo 'Total Errors: 1.' ;;
|
|
compact) echo 'Total Errors:1.' ;;
|
|
esac
|
|
EOF
|
|
chmod +x "$FAKE_WARP"
|
|
|
|
"$RUNNER" \
|
|
--tool warp \
|
|
--endpoint http://127.0.0.1:9000 \
|
|
--access-key test-access \
|
|
--secret-key test-secret \
|
|
--sizes 32767B \
|
|
--rounds 1 \
|
|
--retry-per-round 1 \
|
|
--cooldown-secs 0 \
|
|
--duration 1s \
|
|
--out-dir "${TMP_DIR}/fake-warp-run" \
|
|
--warp-bin "$FAKE_WARP" \
|
|
--server-image-ref rustfs/rustfs:bench \
|
|
--server-image-digest sha256:0123456789abcdef \
|
|
--server-revision 9f61bad94 \
|
|
--require-server-provenance >/dev/null 2>&1
|
|
|
|
rg -q '^32767B,warp,1,1,128,ok,0,[^,]+,[^,]+,63.53 MiB/s,66616033.280000,254.13,18 ms,18.000000,[^,]+,58 ms,58.000000,216 ms,216.000000$' "${TMP_DIR}/fake-warp-run/round_results.csv"
|
|
|
|
cat >"${TMP_DIR}/warp-no-details.log" <<'EOF'
|
|
warp: Starting benchmark in 3s...
|
|
Operation: PUT. Concurrency: 8
|
|
* Average: 2.76 MiB/s, 707.03 obj/s
|
|
EOF
|
|
"$RUNNER" --extract-metrics-from-log "${TMP_DIR}/warp-no-details.log" >"${TMP_DIR}/warp-no-details.csv"
|
|
rg -qx '2.76 MiB/s,2894069.760000,707.03,N/A,N/A,N/A,N/A,N/A,N/A' "${TMP_DIR}/warp-no-details.csv"
|
|
|
|
cat >"${TMP_DIR}/warp-legacy-report.log" <<'EOF'
|
|
Report:
|
|
* Average: 10.00 MiB/s, 40.00 obj/s
|
|
* Reqs: Avg: 2ms, 50%: 1ms, 90%: 3ms, 99%: 4ms, Fastest: 1ms, Slowest: 5ms, StdDev: 1ms
|
|
EOF
|
|
"$RUNNER" --warp-mode put --extract-metrics-from-log "${TMP_DIR}/warp-legacy-report.log" >"${TMP_DIR}/warp-legacy-report.csv"
|
|
rg -qx '10.00 MiB/s,10485760.000000,40.00,2 ms,2.000000,3 ms,3.000000,4 ms,4.000000' "${TMP_DIR}/warp-legacy-report.csv"
|
|
|
|
for error_format in spaced compact; do
|
|
if FAKE_WARP_ERRORS="$error_format" "$RUNNER" \
|
|
--tool warp \
|
|
--endpoint http://127.0.0.1:9000 \
|
|
--access-key test-access \
|
|
--secret-key test-secret \
|
|
--sizes 32767B \
|
|
--rounds 1 \
|
|
--retry-per-round 1 \
|
|
--retry-sleep-secs 1 \
|
|
--cooldown-secs 0 \
|
|
--duration 1s \
|
|
--out-dir "${TMP_DIR}/fake-warp-errors-${error_format}" \
|
|
--warp-bin "$FAKE_WARP" >/dev/null 2>&1; then
|
|
echo "expected Warp ${error_format} request errors to fail the benchmark" >&2
|
|
exit 1
|
|
fi
|
|
rg -q ',failed,1,' "${TMP_DIR}/fake-warp-errors-${error_format}/round_results.csv"
|
|
done
|
|
|
|
"$RUNNER" \
|
|
--tool warp \
|
|
--endpoint http://127.0.0.1:9000 \
|
|
--access-key test-access \
|
|
--secret-key test-secret \
|
|
--sizes 32767B \
|
|
--rounds 1 \
|
|
--retry-per-round 1 \
|
|
--cooldown-secs 0 \
|
|
--duration 1s \
|
|
--out-dir "${TMP_DIR}/fake-warp-candidate" \
|
|
--warp-bin "$FAKE_WARP" \
|
|
--baseline-csv "${TMP_DIR}/fake-warp-run/median_summary.csv" \
|
|
--server-image-ref rustfs/rustfs:bench \
|
|
--server-image-digest sha256:0123456789abcdef \
|
|
--server-revision 9f61bad94 \
|
|
--require-server-provenance >/dev/null 2>&1
|
|
|
|
awk -F',' '
|
|
NR == 1 {
|
|
if (NF != 25 || $15 != "delta_p90_latency_pct" || $18 != "delta_p99_latency_pct" || $25 != "delta_error_rate_pct") exit 1
|
|
}
|
|
NR == 2 {
|
|
if ($15 != "0.00" || $18 != "0.00" || $23 != "0.00" || $25 != "0.00") exit 1
|
|
found = 1
|
|
}
|
|
END { exit found ? 0 : 1 }
|
|
' "${TMP_DIR}/fake-warp-candidate/baseline_compare.csv"
|
|
|
|
for leg in baseline candidate; do
|
|
zero_args=(
|
|
--tool warp
|
|
--endpoint http://127.0.0.1:9000
|
|
--access-key test-access
|
|
--secret-key test-secret
|
|
--sizes 4KiB
|
|
--rounds 1
|
|
--retry-per-round 1
|
|
--cooldown-secs 0
|
|
--duration 1s
|
|
--out-dir "${TMP_DIR}/fake-warp-zero-${leg}"
|
|
--warp-bin "$FAKE_WARP"
|
|
)
|
|
if [[ "$leg" == "candidate" ]]; then
|
|
zero_args+=(--baseline-csv "${TMP_DIR}/fake-warp-zero-baseline/median_summary.csv")
|
|
fi
|
|
FAKE_WARP_ZERO_LATENCY=1 "$RUNNER" "${zero_args[@]}" >/dev/null 2>&1
|
|
done
|
|
|
|
"${SCRIPT_DIR}/hotpath_warp_ab_gate.sh" \
|
|
--compare-csv "${TMP_DIR}/fake-warp-zero-candidate/baseline_compare.csv" \
|
|
--require-tail-error >/dev/null
|
|
|
|
GUARD_BIN="$TMP_DIR/guard-bin"
|
|
mkdir "$GUARD_BIN"
|
|
cat > "$GUARD_BIN/ssh" <<'SSH'
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
command="${*: -1}"
|
|
if [[ "$command" != devices=* ]]; then
|
|
printf 'telemetry fixture\n'
|
|
exit 0
|
|
fi
|
|
host="${@: -2:1}"
|
|
marker="$GUARD_DIR/$host"
|
|
case "${QUEUE_FIXTURE:-quiet}" in
|
|
missing) exit 2 ;;
|
|
hung) exec sleep 60 ;;
|
|
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'
|
|
exit 0
|
|
fi
|
|
;;
|
|
esac
|
|
echo '0.050000 0.070000'
|
|
SSH
|
|
cat > "$GUARD_BIN/curl" <<'CURL'
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
first=10
|
|
tail=3
|
|
if [[ -e "$GUARD_DIR/warp-called" ]]; then
|
|
first=12; tail=4
|
|
case "${RANK_FIXTURE:-valid}" in
|
|
reset) tail=2 ;;
|
|
stale) tail=3 ;;
|
|
esac
|
|
fi
|
|
metric=rustfs_s3_put_object_rename_disk_wait_completion_ms_count
|
|
printf '%s{position="quorum_first"} %s\n' "$metric" "$first"
|
|
if [[ "${RANK_FIXTURE:-valid}" != missing ]]; then
|
|
printf '%s{position="quorum_tail"} %s\n' "$metric" "$tail"
|
|
fi
|
|
CURL
|
|
cat > "$GUARD_BIN/warp" <<'WARP'
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
[[ " $* " == *" --tls "* ]]
|
|
touch "$GUARD_DIR/warp-called"
|
|
exec "$GUARD_FAKE_WARP" "$@"
|
|
WARP
|
|
chmod +x "$GUARD_BIN/"*
|
|
export GUARD_DIR="$TMP_DIR" GUARD_FAKE_WARP="$FAKE_WARP"
|
|
guard_args=(--tool warp --warp-mode put --warp-bin "$GUARD_BIN/warp"
|
|
--endpoint https://localhost:9000 --access-key test --secret-key fixture --sizes 32KiB
|
|
--rounds 1 --retry-per-round 1 --retry-sleep-secs 1 --cooldown-secs 0 --duration 1s
|
|
--node-ssh-target a=host-a --node-ssh-target b=host-b
|
|
--node-queue-devices a=nvme0n1+nvme1n1 --node-queue-devices b=nvme0n1+nvme1n1
|
|
--service-metrics-url http://localhost:9001/metrics --service-metrics-dir "$TMP_DIR/guard-metrics"
|
|
--require-rename-rank-metrics)
|
|
if ! PATH="$GUARD_BIN:$PATH" QUEUE_FIXTURE=reset "$RUNNER" "${guard_args[@]}" --out-dir "$TMP_DIR/guard-pass" >"$TMP_DIR/guard-pass.log" 2>&1; then
|
|
cat "$TMP_DIR/guard-pass.log" >&2
|
|
exit 1
|
|
fi
|
|
test -f "$GUARD_DIR/warp-called"
|
|
awk -F '\t' 'NR>1{last=$1; n++} END{exit !(last==4 && n==8)}' "$TMP_DIR/guard-pass/node_telemetry/queue_32KiB_r1_a1.tsv"
|
|
rg -q ',ok,0,' "$TMP_DIR/guard-pass/round_results.csv"
|
|
|
|
for fixture in missing-rank reset-rank stale-rank missing-node; do
|
|
rm -f "$GUARD_DIR/warp-called"
|
|
if [[ "$fixture" == missing-node ]]; then
|
|
rank=valid
|
|
queue=missing
|
|
else
|
|
rank="${fixture%-rank}"
|
|
queue=quiet
|
|
fi
|
|
if PATH="$GUARD_BIN:$PATH" RANK_FIXTURE="$rank" QUEUE_FIXTURE="$queue" "$RUNNER" \
|
|
"${guard_args[@]}" --out-dir "$TMP_DIR/$fixture" >"$TMP_DIR/$fixture.log" 2>&1; then
|
|
echo "expected $fixture to fail the round" >&2
|
|
exit 1
|
|
fi
|
|
rg -q ',failed,1,' "$TMP_DIR/$fixture/round_results.csv"
|
|
case "$fixture" in
|
|
missing-rank|missing-node) test ! -e "$GUARD_DIR/warp-called" ;;
|
|
*) test -f "$GUARD_DIR/warp-called" ;;
|
|
esac
|
|
done
|
|
|
|
if PATH="$GUARD_BIN:$PATH" QUEUE_FIXTURE=hung "$SCRIPT_DIR/wait_cluster_disk_queue.sh" \
|
|
--target a=host-a --devices a=nvme0n1 --timeout-secs 11 >"$TMP_DIR/queue-timeout.log" 2>&1; then
|
|
echo "expected an unresponsive SSH sample to time out" >&2
|
|
exit 1
|
|
fi
|
|
rg -q 'failed or timed out' "$TMP_DIR/queue-timeout.log"
|
|
|
|
echo "object batch benchmark enhanced tests passed"
|