From dc423e29993ad392ead091673b7f1e3473fc6bf3 Mon Sep 17 00:00:00 2001 From: Rob Ballantyne Date: Mon, 11 May 2026 17:22:45 +0100 Subject: [PATCH] Pin null pyworker benchmark to ~1.0 throughput The startup benchmark previously returned instantly, producing max_throughput around 339895. A null worker has no real throughput concept (each reservation is a unitless slot), so sleep 1s during the benchmark with workload=1 to record max_throughput ~= 1.0. Co-Authored-By: Claude Opus 4.7 (1M context) --- workers/null/worker.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/workers/null/worker.py b/workers/null/worker.py index 480f4d5..21c2c27 100644 --- a/workers/null/worker.py +++ b/workers/null/worker.py @@ -116,6 +116,13 @@ async def reserve_worker(**params: object) -> dict: global _active_reservation if params.get(BENCHMARK_SENTINEL): + # The framework computes max_throughput = workload / time during the + # startup benchmark. A null worker has no throughput concept (a + # reservation is a unitless slot), so we deliberately take ~1s with + # workload=1 to pin max_throughput to ~1.0. Without this the + # near-instant benchmark would report hundreds of thousands of + # workload/sec, distorting any downstream capacity math. + await asyncio.sleep(1.0) return {"ok": True, "benchmark": True} requested = params.get("duration") @@ -166,7 +173,7 @@ worker_config = WorkerConfig( # it to a free worker (or spins up a new one). max_queue_time=0.0, remote_function=reserve_worker, - workload_calculator=lambda _payload: 100.0, + workload_calculator=lambda _payload: 1.0, benchmark_config=BenchmarkConfig( generator=lambda: {BENCHMARK_SENTINEL: True}, runs=1,