Conversation
Motivation: A single HTTP/2 connection queues requests after the server's concurrent stream limit is reached. Issue swift-server#567 asks for configurable connection capacity so those requests can use another connection. Modifications: Add concurrentHTTP2ConnectionsPerHostSoftLimit, defaulting to 1, and expose it through Swift Configuration. Expand on queued demand while respecting pending attempts, stream availability, and required event-loop coverage. Handle retries, SETTINGS, GOAWAY, protocol migration, and capacity released on other event loops. Cover the policy with deterministic state-machine regressions and a localhost TLS/HTTP2 test using one stream per connection. Result: Opt-in clients can use multiple HTTP/2 connections after available streams are exhausted, while the default retains existing migration behavior. The affected macOS suites pass 167 XCTest and 32 configuration tests; format and whitespace checks pass. Maintainer agreement on the proposed API and Linux validation remain pending.
This branch has not been deployed
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.
HTTP/2 requests currently queue behind the server's
MAX_CONCURRENT_STREAMSlimit even when the server could handle more connections. This addsConnectionPool.concurrentHTTP2ConnectionsPerHostSoftLimitfor #567, defaulting to1. With a server limit of one stream and a connection limit of two, two requests can run concurrently while a third remains queued.This is a draft for API and behavior alignment.
Proposed behavior
The setting is also available through Swift Configuration. This proposal expands only after server-advertised stream capacity is exhausted; distributing requests across more connections before saturation is outside this patch.
Validation
On macOS with Swift 6.3.2:
swift test -j 4 --filter 'HTTPConnectionPool|HTTP2|SwiftConfiguration': 167 XCTest + 32 Swift Testing configuration tests passed.git diff --checkpassed.Linux/minimum-toolchain validation, the full package suite, and throughput/latency benchmarks have not been run. The localhost test establishes concurrent capacity, not a measured performance improvement.
Does the default, required-event-loop exception, and demand-driven growth policy match the intended scope of #567?