You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--load-workers <n> spreads one --load run over n generator processes and merges their results into one summary, for when a single Node process rather than the server is the bottleneck.
How it works
Parent: the CLI the user ran connects once, so any login is done first. It then re-runs its own command (process.argv, minus --load-workers) as n forked children with MCP_INSPECTOR_LOAD_SHARD=<i>/<n>, and waits.
Worker: takes its share with shardLoadOptions. Concurrency, --load-requests and --load-rate are split as evenly as integers allow; everything else applies to every worker as given. It connects with stored credentials only, runs the shared engine, and sends { summary, raw } to the parent over IPC instead of printing.
Exact merge:LatencyRecorder, ErrorTally and OutcomeStats gain snapshot()/merge(). Recorders stay exact while both sides' samples fit, and fall back to adding bucket counts once either side has switched, so the merged percentiles equal one recorder fed every call (tested). Counts and rate figures add, and elapsedMs is the slowest worker's. The summary gains workers: n. Thresholds and --load-baseline judge the merged result through the existing code.
Stops: a worker's early stop (circuit breaker, stop on breach) makes the parent stop the rest with the same LoadStop. Ctrl+C or SIGTERM in the parent forwards an interrupt to every worker, and the merged partial summary still prints and exits 130. A worker that exits without reporting fails the run with its exit code (load_worker_failed) once the others have stopped.
{{seq}} / {{worker}} stay unique across processes (shardContext interleaves them).
Progress lines add up the workers' latest reports. Their p50 and p99 are the slowest worker's, since percentiles don't add; the final summary is exact.
Engine plumbing: a raw hook that hands the measured window's mergeable stats over as it ends, a shard option, and both threaded through runLoad / runLoadAcrossConnections / LoadRunExtras.
Scope decisions
One-shot CLI only. mcpdo runs the engine inside its daemon on a held connection, so there is no command for it to re-run as a worker. The mcpdo README and agent skill point at mcp-inspector --cli … --load-workers instead.
Refused combinations:--load-steps/--load-ramp, --load-interval, --load-connections, --load-churn, --load-subscribe and --output. Each produces per-stage, per-bucket, per-session or per-call output that would need a merge of its own. Also refused: stdio servers (each worker would spawn its own server) and n above --load-concurrency or --load-requests.
The CLI README has a new section; the mcpdo README and the agent skill are updated.
sharding, seq uniqueness, argv stripping and the refusals
mergeLoadWorkerResults over real engine runs (steps, warm-up, stops, rate figures)
progress merging
runLoadWorkers with fake workers (results, stop propagation, interrupt, worker failure)
runAsLoadWorker and processWorkerPort
an end-to-end run: the in-process CLI forks three real built-CLI workers against an HTTP test server, and the test asserts the merged counts and nine distinct {{seq}} values.
Adds --load-workers <n> to the one-shot CLI to distribute load generation across processes when a single Node process becomes the bottleneck, addressing #2914.
Changes:
Adds worker spawning, workload sharding, IPC result collection, progress aggregation, and stop forwarding.
Extends shared load statistics with snapshot/merge support and reports worker counts in summaries.
Adds merge, orchestration, and end-to-end tests, plus documentation explaining supported combinations and the mcpdo limitation.
File
Description
skills/mcpdo/SKILL.md
Directs users to the one-shot CLI for multi-process load generation.
core/cli/handlers/load-workers.ts
Implements worker orchestration, sharding, IPC, and summary merging.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d7f533d. scenarioPicker takes the shard, and worker i of n takes every n-th pick of the one weighted sequence, starting at i. The processes together therefore run the mix one picker would. Test added with your example (two 1:1 steps, two requests, two workers), which now calls each step once.
Shard offsets fail to preserve the combined load-rate schedule
core/cli/handlers/load-workers.ts:105
Dividing the rate leaves every process with an immediate first slot: --load-rate 1 --load-duration 1 --load-concurrency 4 --load-workers 4 can start four calls instead of one. Longer runs can also cluster starts rather than preserve the evenly spaced rate grid. Coordinate a shared start epoch and shard-specific slot offsets so the combined run preserves the requested pacing.
Inline: the scenario mix is now balanced per worker (a rotated start, no stride). See the thread.
Previously missed (no thread), the rate burst: each worker's rate grid now starts offset by index × interval / count, so the workers interleave into the run's even spacing. --load-rate 1 --load-duration 1 --load-concurrency 4 --load-workers 4 now starts one call (test added), and the rate figures measure each worker's window from its own grid start. A shared wall-clock epoch across processes is not attempted: the processes start milliseconds apart, and the README now states that this shifts the grids by as much.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active issues inflate the merged achieved rate by using offset-shortened denominators and skew argument coverage by coupling row selection to the interleaved worker sequence.
The interleaved seq also selects argument rows in loadArgsTemplate (load-template.ts:264), so with two workers and a two-row sequential --load-args-file, each process always uses just one row. In a duration-bound run with concurrency two, if those inputs take 1 ms and 100 ms respectively, the alternating workload becomes roughly 100:1. Keep each process's row-cycling position separate from the globally unique placeholder sequence so every process exercises the full argument cycle.
Inline: the merged achievedRate is now computed over a common window.
Previously missed (no thread), argument rows: LoadCallContext gains an optional row (not a placeholder), which shardContext sets to the process's own call count. A sequential --load-args-file therefore cycles every row in every worker while {{seq}} stays globally unique. Test added; README updated.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Inconsistent achieved-rate denominators across request-capped shards underreport an unsaturated 4/s schedule as 3.04/s, requiring a common-window calculation and regression coverage.
Copilot round 4, fixed in d03981d: the merged achieved rate is now computed over the run's own window, request-capped runs included. Requesting round 5.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Request-capped runs with unequal worker latencies can report an inflated achievedRate because the measurement window excludes some counted request starts.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The afterLast clamp overstates achieved rate in saturated duration-bound runs; it needs request-exhaustion-only truncation and a regression test covering the duration-bound case.
Copilot round 7 had no inline comments and nothing suppressed; the headline names no specific finding. The open issue it counts is resolved threads awaiting resolution. Closing the review loop on this round.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2914
--load-workers <n>spreads one--loadrun overngenerator processes and merges their results into one summary, for when a single Node process rather than the server is the bottleneck.How it works
process.argv, minus--load-workers) asnforked children withMCP_INSPECTOR_LOAD_SHARD=<i>/<n>, and waits.shardLoadOptions. Concurrency,--load-requestsand--load-rateare split as evenly as integers allow; everything else applies to every worker as given. It connects with stored credentials only, runs the shared engine, and sends{ summary, raw }to the parent over IPC instead of printing.LatencyRecorder,ErrorTallyandOutcomeStatsgainsnapshot()/merge(). Recorders stay exact while both sides' samples fit, and fall back to adding bucket counts once either side has switched, so the merged percentiles equal one recorder fed every call (tested). Counts and rate figures add, andelapsedMsis the slowest worker's. The summary gainsworkers: n. Thresholds and--load-baselinejudge the merged result through the existing code.LoadStop. Ctrl+C or SIGTERM in the parent forwards an interrupt to every worker, and the merged partial summary still prints and exits 130. A worker that exits without reporting fails the run with its exit code (load_worker_failed) once the others have stopped.{{seq}}/{{worker}}stay unique across processes (shardContextinterleaves them).rawhook that hands the measured window's mergeable stats over as it ends, ashardoption, and both threaded throughrunLoad/runLoadAcrossConnections/LoadRunExtras.Scope decisions
mcp-inspector --cli … --load-workersinstead.--load-steps/--load-ramp,--load-interval,--load-connections,--load-churn,--load-subscribeand--output. Each produces per-stage, per-bucket, per-session or per-call output that would need a merge of its own. Also refused: stdio servers (each worker would spawn its own server) andnabove--load-concurrencyor--load-requests.The CLI README has a new section; the mcpdo README and the agent skill are updated.
Tests
clients/cli/__tests__/load-workers.test.tscovers:sequniqueness, argv stripping and the refusalsmergeLoadWorkerResultsover real engine runs (steps, warm-up, stops, rate figures)runLoadWorkerswith fake workers (results, stop propagation, interrupt, worker failure)runAsLoadWorkerandprocessWorkerPort{{seq}}values.npm run local:gateis green.🤖 Generated with Claude Code