test(common): load tests for bounded pool and stream opening - #409
Open
heeckhau wants to merge 6 commits into
Open
test(common): load tests for bounded pool and stream opening#409heeckhau wants to merge 6 commits into
heeckhau wants to merge 6 commits into
Conversation
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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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 withnum_threadsworkers runs 1024 dispatched sub-tasks while a counting spawn callback confirms exactlynum_threadsworkers 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::mapover 256 items with a concurrency limit of 8 never has more thanlimit + 1mux channels open at once (the window plus the parent context's own channel). ACountingMuxtracks 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.