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 <cursoragent@cursor.com>
This commit is contained in:
@@ -130,7 +130,8 @@ fi
|
|||||||
|
|
||||||
command -v pgbench >/dev/null 2>&1 || die "pgbench is not installed"
|
command -v pgbench >/dev/null 2>&1 || die "pgbench is not installed"
|
||||||
|
|
||||||
# 计时窗口才受负载门槛约束。生命周期自检(--hold-after-start)不测量吞吐。
|
# 计时窗口才受负载门槛约束,并且在创建实例之前判断。
|
||||||
|
# 生命周期自检(--hold-after-start)不测量吞吐。
|
||||||
resource_gate() {
|
resource_gate() {
|
||||||
local avail_kb load1
|
local avail_kb load1
|
||||||
avail_kb="$(df -Pk "$ROOT" | awk 'NR==2 { print $4 }')"
|
avail_kb="$(df -Pk "$ROOT" | awk 'NR==2 { print $4 }')"
|
||||||
@@ -157,6 +158,10 @@ cleanup() {
|
|||||||
}
|
}
|
||||||
trap cleanup EXIT INT TERM
|
trap cleanup EXIT INT TERM
|
||||||
|
|
||||||
|
if [[ "$HOLD_AFTER_START" -eq 0 ]]; then
|
||||||
|
resource_gate
|
||||||
|
fi
|
||||||
|
|
||||||
TS="$(date +%Y%m%d-%H%M%S)"
|
TS="$(date +%Y%m%d-%H%M%S)"
|
||||||
RESULTS="$HERE/results/pgbench-$TS"
|
RESULTS="$HERE/results/pgbench-$TS"
|
||||||
mkdir -p "$RESULTS"
|
mkdir -p "$RESULTS"
|
||||||
@@ -191,8 +196,6 @@ if [[ "$HOLD_AFTER_START" -eq 1 ]]; then
|
|||||||
sleep 3600
|
sleep 3600
|
||||||
fi
|
fi
|
||||||
|
|
||||||
resource_gate
|
|
||||||
|
|
||||||
DSN="$("$ROOT/scripts/svc.sh" db dsn "$NAME" --reveal)"
|
DSN="$("$ROOT/scripts/svc.sh" db dsn "$NAME" --reveal)"
|
||||||
|
|
||||||
psql "$DSN" -v ON_ERROR_STOP=1 -c "SELECT version()" >"$RESULTS/pg-version.txt"
|
psql "$DSN" -v ON_ERROR_STOP=1 -c "SELECT version()" >"$RESULTS/pg-version.txt"
|
||||||
|
|||||||
Reference in New Issue
Block a user