Skip to content

Commit af0922c

Browse files
committed
Keep saturated benchmark observers online
1 parent adae97b commit af0922c

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

.github/workflows/upstream-runtime-comparison.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ jobs:
282282
"measure=$CAMPAIGN_MEASURE_SECONDS" \
283283
'preflightWarmup=10' 'preflightSettle=5' 'preflightMeasure=10' \
284284
'paper=26.1.2-74' 'client=26.1.2' \
285+
'networkTimeoutSeconds=300' \
285286
"availableCpuCount=$available_cpu_count" \
286287
"serverCpuSet=$server_cpu_set" \
287288
"clientCpuSet=$client_cpu_set"
@@ -341,6 +342,7 @@ jobs:
341342
"warmupSeconds": int(warmup),
342343
"settleSeconds": int(settle),
343344
"measureSeconds": int(measure),
345+
"networkTimeoutSeconds": 300,
344346
"runtimeProfile": runtime_profile,
345347
"samplingMode": "independent-runners",
346348
"requestedFlags": {
@@ -848,6 +850,7 @@ jobs:
848850
"runs": int(runs),
849851
"runtimeProfile": "optimized-candidate",
850852
"samplingMode": "independent-runners",
853+
"networkTimeoutSeconds": 300,
851854
}
852855
for field, value in expected.items():
853856
if data.get(field) != value:
@@ -976,6 +979,8 @@ jobs:
976979
f"{document_name} effective flags drifted in {row['RunId']}")
977980
if run_manifest.get("runtimeProfile") != runtime_profile:
978981
raise SystemExit(f"runtime profile drifted in {row['RunId']}")
982+
if run_manifest.get("networkTimeoutSeconds") != 300:
983+
raise SystemExit(f"network timeout drifted in {row['RunId']}")
979984
if scenario == "block-active":
980985
block_guards = {
981986
"furnaceBlocks": 205,

tools/perf/run-upstream-runtime-once.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ scene_size="$COMPARE_SCENE_SIZE"
2929
warmup_seconds="$COMPARE_WARMUP_SECONDS"
3030
settle_seconds="$COMPARE_SETTLE_SECONDS"
3131
measure_seconds="$COMPARE_MEASURE_SECONDS"
32+
# This only prevents the synthetic observer from being kicked while the
33+
# official upstream stalls; it does not alter the server's 20 TPS target.
34+
network_timeout_seconds=300
3235
server_port="${COMPARE_SERVER_PORT:-25565}"
3336
protocol_trace_enabled="${COMPARE_PROTOCOL_TRACE_ENABLED:-0}"
3437
protocol_trace_max_events="${COMPARE_PROTOCOL_TRACE_MAX_EVENTS:-500000}"
@@ -231,6 +234,11 @@ view-distance=4
231234
white-list=false
232235
EOF
233236

237+
cat > "$run_directory/spigot.yml" <<EOF
238+
settings:
239+
timeout-time: $network_timeout_seconds
240+
EOF
241+
234242
plugin_sha256="$(sha256sum "$plugin_jar" | awk '{print $1}')"
235243
driver_sha256="$(sha256sum "$driver_jar" | awk '{print $1}')"
236244
paper_sha256="$(sha256sum "$paper_jar" | awk '{print $1}')"
@@ -557,13 +565,16 @@ if data.get("effectiveFlags") != expected_effective_flags:
557565
f"comparison effective flags mismatch: "
558566
f"{data.get('effectiveFlags')!r} != {expected_effective_flags!r}"
559567
)
560-
if data.get("seconds", 0) < measure - 2 or data.get("seconds", 0) > measure + 3:
561-
raise SystemExit(f"comparison measurement duration is invalid: {data.get('seconds')}")
562-
if data.get("tickSamples", 0) <= 0 or data.get("observedTps", 0) <= 0:
563-
raise SystemExit("comparison produced no valid tick samples")
564568
allows_upstream_saturation = (
565569
measure >= 60 and scenario == "block-active" and variant == "A"
566570
)
571+
# The stop command is handled on the saturated main thread, so its wall-clock
572+
# acknowledgement can trail the requested window without invalidating it.
573+
maximum_seconds = measure + (30 if allows_upstream_saturation else 3)
574+
if data.get("seconds", 0) < measure - 2 or data.get("seconds", 0) > maximum_seconds:
575+
raise SystemExit(f"comparison measurement duration is invalid: {data.get('seconds')}")
576+
if data.get("tickSamples", 0) <= 0 or data.get("observedTps", 0) <= 0:
577+
raise SystemExit("comparison produced no valid tick samples")
567578
if allows_upstream_saturation:
568579
# Sustained block load is allowed to expose the official upstream's
569580
# throughput ceiling. The rewritten candidate remains subject to the
@@ -636,7 +647,7 @@ python3 - "$run_directory/run-manifest.json" "$run_id" "$scenario" "$variant" \
636647
"$protocol_trace_aggregate_packet_allowlist" \
637648
"$trace_window_start_epoch_ms" "$trace_window_end_epoch_ms" \
638649
"$available_cpu_count" "$server_cpu_set" "$client_cpu_set" \
639-
"$runtime_profile" "$metrics_path" <<'PY'
650+
"$runtime_profile" "$network_timeout_seconds" "$metrics_path" <<'PY'
640651
from pathlib import Path
641652
import json
642653
import sys
@@ -648,7 +659,7 @@ import sys
648659
trace_enabled, trace_packet_allowlist, trace_aggregate_packet_allowlist,
649660
trace_window_start_epoch_ms, trace_window_end_epoch_ms,
650661
available_cpu_count, server_cpu_set, client_cpu_set,
651-
runtime_profile, metrics_path,
662+
runtime_profile, network_timeout_seconds, metrics_path,
652663
) = sys.argv[1:]
653664
metrics = json.load(open(metrics_path, encoding="utf-8"))
654665
Path(output).write_text(json.dumps({
@@ -658,6 +669,7 @@ Path(output).write_text(json.dumps({
658669
"variant": variant,
659670
"variantMeaning": "official-upstream" if variant == "A" else "rewritten-candidate",
660671
"runtimeProfile": runtime_profile,
672+
"networkTimeoutSeconds": int(network_timeout_seconds),
661673
"requestedFlags": metrics["requestedFlags"],
662674
"effectiveFlags": metrics["effectiveFlags"],
663675
"sceneSize": int(scene_size),

0 commit comments

Comments
 (0)