feat(http2): auto-expand connection pool on burst instead of erroring#71
Merged
wyeth930203 merged 4 commits intoMay 28, 2026
Merged
Conversation
Per-host pool now doubles capacity on demand when saturated, replacing the "Connection pool exhausted" error path. The `OwnedSemaphorePermit` is held alongside each `PooledConnection` so the semaphore truly caps live connections; expansion uses `add_permits` (in-place, no rebuild), guarded by `Semaphore::MAX_PERMITS` to avoid panics, and falls back to `tokio::time::timeout(connect_timeout, acquire_owned())` to handle the race where new permits are stolen by other tasks. - Add `PoolStats::pool_expansions` and `warn!` log per expansion event - Lower default `max_connections_per_host` from 10 to 8 (auto-grows now) - Add example `http2_pool_expand` demonstrating 2 -> 4 -> 8 growth
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 66 files with indirect coverage changes 🚀 New features to boost your workflow:
|
1158f6c to
f35485d
Compare
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.
Per-host pool now doubles capacity on demand when saturated, replacing the "Connection pool exhausted" error path. The
OwnedSemaphorePermitis held alongside eachPooledConnectionso the semaphore truly caps live connections; expansion usesadd_permits(in-place, no rebuild), guarded bySemaphore::MAX_PERMITSto avoid panics, and falls back totokio::time::timeout(connect_timeout, acquire_owned())to handle the race where new permits are stolen by other tasks.PoolStats::pool_expansionsandwarn!log per expansion eventmax_connections_per_hostfrom 10 to 8 (auto-grows now)http2_pool_expanddemonstrating 2 -> 4 -> 8 growthOverview:
Details:
Where should the reviewer start?
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)