Skip to content

test(common): load tests for bounded pool and stream opening - #409

Open
heeckhau wants to merge 6 commits into
devfrom
test/global-pool-load-tests
Open

test(common): load tests for bounded pool and stream opening#409
heeckhau wants to merge 6 commits into
devfrom
test/global-pool-load-tests

Conversation

@heeckhau

@heeckhau heeckhau commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Adds load tests verifying the bounding guarantees from the executor/global-pool refactor in #403.

Stacked on top of #403 (base branch is feat/global-pool), so the diff here is just the new tests.

What this verifies

crates/common/src/context/test/load.rs:

  • test_thread_pool_thread_count_is_bounded — a pool built with num_threads workers runs 1024 dispatched sub-tasks while a counting spawn callback confirms exactly num_threads workers are ever started. Dispatching work multiplexes onto the fixed pool rather than spawning a thread per task.
  • test_map_bounds_open_streams (pooled + cooperative) — Context::map over 256 items with a concurrency limit of 8 never has more than limit + 1 mux channels open at once (the window plus the parent context's own channel). A CountingMux tracks the peak concurrently-open channels via a drop-guarded transport; an arrival gate forces a full window to overlap so the peak genuinely reaches the limit. Without the fix the peak would be ~257, which is what would exceed a mux's max-stream limit.

sinui0 and others added 6 commits May 21, 2026 19:34
Verify the executor/global-pool refactor (#403) guarantees:
- a ThreadPool spawns exactly num_threads workers regardless of how
  many sub-tasks are dispatched, and
- Context::map keeps at most concurrency_limit mux channels open at
  once, even when given far more items than that.

A CountingMux tracks the peak number of concurrently-open channels via
a drop-guarded transport; an arrival gate forces a full window to
overlap so the peak actually reaches the limit.
Base automatically changed from feat/global-pool to dev June 3, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants