Skip to content

cmd: bound the per-runner check fan-out#2577

Draft
bendrucker wants to merge 1 commit into
construction-perf-tffrom
fanout-bound
Draft

cmd: bound the per-runner check fan-out#2577
bendrucker wants to merge 1 commit into
construction-perf-tffrom
fanout-bound

Conversation

@bendrucker

Copy link
Copy Markdown
Member

The per-runner check fan-out launched one goroutine per module-call runner with no
bound, so peak concurrency equaled the number of runners. When a check guards a remote
service, as the deep_check case in #1113 does, hundreds of module calls become hundreds of
simultaneous requests. That is what produced the STS throttling and false no such host
failures.

This caps the fan-out. A single worker count is resolved from --max-workers (or the
number of CPUs, or 1 under --no-parallel-runners) and applied with errgroup.SetLimit.
The recursive directory pool already derived its bound the same way, so both now draw from
one helper and the two concurrency layers share a budget. errgroup.Wait also blocks
until every check finishes, so a failing check no longer leaves goroutines touching a
runner after Clean.

No user-facing flags change. --max-workers and --no-parallel-runners keep their
meaning, and --max-workers now bounds the per-runner path too.

Measured with the end-to-end fan-out benchmark from #2573, at 1000 module calls this caps
peak concurrency at the worker count instead of ~900. Wall-clock rises under the bound,
which is the intent: it trades throughput for bounded resource use, the safety property the
storm needs.

Stacked on #2576.

The per-runner check fan-out launched an unbounded goroutine per module-call runner, so peak concurrency tracked the runner count. Under a deep check that guards a remote service, hundreds of module calls turn into hundreds of simultaneous requests (the #1113 storm).

Resolve a single worker count (--max-workers or NumCPU, or 1 under --no-parallel-runners) and cap the fan-out with errgroup.SetLimit. The same count now governs the recursive directory pool, so resolution lives in one place. errgroup also waits for every check before returning, so a failing check no longer leaves goroutines running after Clean.

At 1000 module calls the end-to-end benchmark caps peak concurrency at the worker count instead of ~900. Wall-clock rises with the bound, which is the intended trade of throughput for bounded resource use.

Claude-Session: https://claude.ai/code/session_01SFtKL5iaFWPVDqdcyvPiCJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant