From b2e129ab3f3bdf222f16040fcd0513872d0e2a3c Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 12 Oct 2026 13:19:40 +0000 Subject: [PATCH] Check host load before creating the pgbench instance Why: A timed window that starts under load average above 16 is not a usable baseline, and creating the instance first only to pause wastes a startup. Evidence: The rerun at load 24.03 exited 3 before any timed window and removed the instance. Impact: The pause now happens before initdb. No change to the benchmark itself. Refs: docs/release-multi-instance.md B6 Co-authored-by: Cursor --- tests/load/collaboration/run_pgbench.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/load/collaboration/run_pgbench.sh b/tests/load/collaboration/run_pgbench.sh index 05f394cd..1be22d43 100755 --- a/tests/load/collaboration/run_pgbench.sh +++ b/tests/load/collaboration/run_pgbench.sh @@ -130,7 +130,8 @@ fi command -v pgbench >/dev/null 2>&1 || die "pgbench is not installed" -# 计时窗口才受负载门槛约束。生命周期自检(--hold-after-start)不测量吞吐。 +# 计时窗口才受负载门槛约束,并且在创建实例之前判断。 +# 生命周期自检(--hold-after-start)不测量吞吐。 resource_gate() { local avail_kb load1 avail_kb="$(df -Pk "$ROOT" | awk 'NR==2 { print $4 }')" @@ -157,6 +158,10 @@ cleanup() { } trap cleanup EXIT INT TERM +if [[ "$HOLD_AFTER_START" -eq 0 ]]; then + resource_gate +fi + TS="$(date +%Y%m%d-%H%M%S)" RESULTS="$HERE/results/pgbench-$TS" mkdir -p "$RESULTS" @@ -191,8 +196,6 @@ if [[ "$HOLD_AFTER_START" -eq 1 ]]; then sleep 3600 fi -resource_gate - DSN="$("$ROOT/scripts/svc.sh" db dsn "$NAME" --reveal)" psql "$DSN" -v ON_ERROR_STOP=1 -c "SELECT version()" >"$RESULTS/pg-version.txt"