feat(llm-bench): route generation sweeps and sustained load - #134
feat(llm-bench): route generation sweeps and sustained load#134ishaan-shivhare wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Stale comment
Risk: medium. Left a non-blocking comment (not approved): Bugbot completed with an unresolved soft-stop/SIGINT finding, and this routed-batch/cache/repeat change exceeds the low-risk auto-approve threshold. Assigning reviewers for human review of measurement correctness and interrupt handling.
Sent by Cursor Approval Agent: Pull Request Approver
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 14a7672. Configure here.
| timeout=60, | ||
| ) | ||
| response.raise_for_status() | ||
| logger.info("Fixed-prompt warmup complete on generator worker %d", self.generator_worker_index) |
There was a problem hiding this comment.
Warmup skips transient request retries
Medium Severity
_warm_prompt_cache issues a single requests.post and lets any RequestException (TLS/network close, HTTP 408/429 via raise_for_status) escape. warm_worker_once then stores that failure in the shared AsyncResult, so every later user on that worker fails immediately and on_start exits the Locust process. This breaks the llm_bench warmup retry rule that transient transport failures should use a bounded backoff loop.
Additional Locations (1)
Triggered by learned rule: llm_bench warmup: retry transient requests.exceptions.RequestException with bounded backoff
Reviewed by Cursor Bugbot for commit 14a7672. Configure here.
| headers=dict(self.client.headers), | ||
| data=json.dumps(data), | ||
| timeout=60, | ||
| ) |
There was a problem hiding this comment.
Warmup timeout too short
Medium Severity
Non-streaming cache warmup hard-codes timeout=60 while forcing stream=False. The README’s sustained-load example warms ~128k-token prompts, so the full prefill must finish before any bytes return. That commonly exceeds 60s and fails startup even when the deployment is healthy.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 14a7672. Configure here.
There was a problem hiding this comment.
Risk: medium. Left a non-blocking comment (not approved): Bugbot ended as skipping with unresolved medium warmup findings, and this routed-batch/cache change exceeds the low-risk auto-approve threshold. Two reviewers are already assigned for human review.
Sent by Cursor Approval Agent: Pull Request Approver




Summary
num_servers * num_gensand send one explicitly targetedn > 1completions request per selected workergen_load_test.pymeasurements so cache misses cannot silently become retriesload_test.pyload_test.py: Locust users are assigned round-robin to generator workers and continuously replenish requests--reuse-promptto materialize and reuse one exact prompt across all load-test requests--warmup-prompt-cacheto prime each targeted worker once before its measured traffic beginsload_test.py; cached-token counts remain visible through existing logs and metricsnwhen validating output-token countsWhy
gen_load_test.pyshould remain a latency-per-forward sweep tool. Its routed mode now measures the intended backend batching path by splitting a requested global batch into onen > 1request per generator worker.Continuous profiling traffic belongs in
load_test.py, which already owns concurrency, request replenishment, Ctrl-C/runtime termination, and Locust metrics. With-u 16 --num-servers 8 --num-gens 1 -n 128, two Locust users target each generator service. One request can remain queued while the active request drains, keeping occupancy much steadier than globally repeating sweep rounds.Fixed-prompt mode makes cache reuse explicit. Each worker receives one
max_tokens=0warmup with the same prompt and stable session id used by its subsequent traffic. Load testing records cache behavior without aborting the run on a cache miss.Validation
The only warning is the existing Locust/gevent monkey-patch warning produced by the test import order.
Note
Low Risk
Changes are confined to benchmark/load-test clients and docs; they do not alter production inference paths, though misconfigured routing headers could skew load-test results.
Overview
Generation benchmark (
gen_load_test) no longer fans a routed global batch into many concurrentn=1calls. It splits the batch across targeted generator workers via new sharedgenerator_routinghelpers and sends one concurrentn > 1request per worker, with per-worker usage and forward-pass math. Measured runs must prove a full shareable-prefix prompt-cache hit (header/body cached token counts); misses raisePromptCacheVerificationErrorand are not retried. The old 64-request sequential pre-warmup hack is removed in favor of one warmup per worker when routing is on.Locust load test (
load_test) adds--reuse-prompt,--warmup-prompt-cache(onemax_tokens=0warmup per targeted worker, deduplicated), and--num-servers/--num-gensso users round-robin to generator targeting headers with a shareduserid per worker for session-aware caching. Response parsing aggregates multiplechoiceswhenn > 1, and token-count warnings expectmax_tokens * n.README documents the sustained cached-load workflow and an example command.
Reviewed by Cursor Bugbot for commit 14a7672. Bugbot is set up for automated code reviews on this repo. Configure here.