Skip to content

[HTTPClient.Configuration] Make connection pool size configurable #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

fabianfett
Copy link
Member

Fixes #373

@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Sep 24, 2021
@fabianfett fabianfett added this to the HTTP/2 support milestone Sep 24, 2021
@fabianfett fabianfett force-pushed the ff-make-http1-pool-size-configurable branch 2 times, most recently from e318759 to 41b5b16 Compare September 24, 2021 09:39
@fabianfett
Copy link
Member Author

Currently includes #438. Added to check, if #438 actually fixes the failures.

}
}
}
let timeout = DispatchTime.now() + .seconds(180)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This timeout is really long for CI. Can we lower it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid we will need to change the number of requests and threads to something smaller, if we change the timeout to 60 seconds :)

Test Case 'HTTPClientTests.testConnectionPoolSizeConfigValueIsRespected' started at 2021-09-24 13:48:02.845
/code/Tests/AsyncHTTPClientTests/HTTPClientTests.swift:3101: error: HTTPClientTests.testConnectionPoolSizeConfigValueIsRespected : failed - Timed out
/code/Tests/AsyncHTTPClientTests/HTTPClientTests.swift:3089: error: HTTPClientTests.testConnectionPoolSizeConfigValueIsRespected : XCTAssertNoThrow failed: threw error "HTTPClientError.cancelled" - 
/code/Tests/AsyncHTTPClientTests/HTTPClientTests.swift:3089: error: HTTPClientTests.testConnectionPoolSizeConfigValueIsRespected : XCTAssertNoThrow failed: threw error "HTTPClientError.alreadyShutdown" - 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced the amount of requests.

self.init(idleTimeout: idleTimeout, concurrentHTTP1ConnectionsPerHostSoftLimit: 8)
}

public init(idleTimeout: TimeAmount = .seconds(60), concurrentHTTP1ConnectionsPerHostSoftLimit: Int = 8) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid a new defaulted parameter here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just remove the default value and get the "behaviour" of a default value because we have the init above which only takes idleTimeout as a parameter.

@fabianfett fabianfett force-pushed the ff-make-http1-pool-size-configurable branch 2 times, most recently from fa60917 to 149fdca Compare September 24, 2021 13:43
@fabianfett fabianfett requested a review from Lukasa September 24, 2021 13:43
@fabianfett
Copy link
Member Author

Failing swift-nightly ci because of Sendable requirements.

@fabianfett fabianfett force-pushed the ff-make-http1-pool-size-configurable branch from 149fdca to 0334abf Compare September 24, 2021 14:02
@fabianfett fabianfett force-pushed the ff-make-http1-pool-size-configurable branch from 0334abf to 58013d9 Compare September 24, 2021 14:04
@fabianfett fabianfett added 🆕 semver/minor Adds new public API. and removed 🔨 semver/patch No public API change. labels Sep 24, 2021
@fabianfett fabianfett merged commit 2a47a1d into swift-server:main Sep 27, 2021
@fabianfett fabianfett deleted the ff-make-http1-pool-size-configurable branch September 27, 2021 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make maximumConcurrentConnections configurable
3 participants