feat(client): resize connection pools at runtime - #599
Merged
Conversation
SunSi12138
force-pushed
the
issue-587-runtime-connection-pool-sizing
branch
from
September 8, 2026 01:41
3ff2685 to
3bccdef
Compare
SunSi12138
marked this pull request as ready for review
September 8, 2026 05:58
SunSi12138
commented
Sep 8, 2026
SunSi12138
left a comment
Owner
Author
There was a problem hiding this comment.
One engineering-significant concurrency issue in the resize retirement-budget accounting; inline below. I otherwise did not find a reason to broaden the scope.
SunSi12138
force-pushed
the
issue-587-runtime-connection-pool-sizing
branch
from
September 8, 2026 06:57
e2b09fa to
2de2e08
Compare
SunSi12138
marked this pull request as draft
September 8, 2026 06:59
SunSi12138
marked this pull request as ready for review
September 8, 2026 06:59
30 tasks
This was referenced Sep 8, 2026
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.
Closes #587
Runtime sizing surface
Adds one live connection-capacity generation over the existing fixed/static/dynamic Client lifecycle.
{MinConnections, MaxConnections};{MaxConnections, MaxConnectionsPerEndpoint}while leavingMinReadyEndpoints, endpoint membership, selection and resolver semantics unchanged;Reconciliation semantics
MinConnectionsgrowth reuses the existing reconnect/connection creation path;Drainingbefore they disappear from new-attempt eligibility;Review follow-up: shared retirement budget
The review correctly identified that the earlier implementation only combined resize and normal retirement counts from the resize side. That left a race where a normal GoAway/topology retirement could reserve another active retirement after resize had sampled the count.
The follow-up removes the separate
_resizeRetiringConnectionsaccounting entirely. For an active resize candidate, the capacity check and the existingMarkConnectionDrainingtransition are now serialized under the cluster's ownLock. The transition therefore inserts the resize drain into the same static/dynamic retiring collection already used by normal GoAway/topology retirement. Both lifecycle sources now observe one authoritative active-retirement count, and an exhausted budget makes resize wait rather than force-close existing work.A narrow control-plane accessor is still used to reach the private nested runtime gate/count without exposing new public/runtime surface; the unlocked read and second retiring-state domain that caused the concurrency bug are gone.
Regression coverage
SharpLinkClientRuntimeConnectionPoolSizingTestscovers:MaxRetiringConnections = 0: active surplus remains Ready/connected rather than being force-closed, then converges after active work drains;StaticResizeReservationShouldBeVisibleToNormalRetirementBudget: resize first consumes the single active-retirement slot, then the normal cluster retirement entry point is exercised and must observe that reservation rather than creating a second active drain;The branch was cleanly restacked onto current
devso exact-head hardening workflows contain their current #576/#571 test infrastructure while the PR diff remains limited to the five #587 files.Branch head:
2de2e08692dd0f2557ef4f01fb1f0235a238ec33.Validated target:
dev@d3eab9e4b54da1d9e6984e15481d6fee714bfb70.Validation
34196978321: PASS — formatting/maintainability, Release build, generated-assembly boundary, full Unit/Generator/Load suites, and deterministic allocation gate.34196978288: PASS.34196978137: PASS.34196978147: PASS.34197193068: PASS — Debug/Release builds, Integration Tests, NativeAOT transport/topology smoke, package contract verification/smoke, demo/load smoke, and the complete six-platform desktop codec compatibility matrix.