-
Notifications
You must be signed in to change notification settings - Fork 87
Make multiplexer's targetWindowSize configurable #202
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
Make multiplexer's targetWindowSize configurable #202
Conversation
|
Can one of the admins verify this patch? |
7 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
Lukasa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this broadly looks really good! I've left some notes in the diff that we need to address.
Additionally, while using Int32 internally is just fine, the public API should use Int. In general, wherever possible in public API it is better to use Int than one of the sized integer types. This allows users to pass numbers around using the currency type, and for them to be converted internally.
Lukasa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, this looks good. Can we duplicate some tests to actually set the new target window size? It’d be good to have something that validates the existence of the parameter in these two cases.
| /// - parameters: | ||
| /// - h2ConnectionChannelConfigurator: An optional callback that will be invoked only | ||
| /// when the negotiated protocol is H2 to configure the connection channel. | ||
| /// - targetWindowSize: The target size of the inbound flow control window. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call out that this is the HTTP/2 flow control window specifically?
|
Duplicated all tests in the |
Lukasa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'm generally happy with this, just a few notes.
| initialLocalSettings: [HTTP2Setting] = nioDefaultSettings, | ||
| position: ChannelPipeline.Position = .last, | ||
| inboundStreamStateInitializer: ((Channel, HTTP2StreamID) -> EventLoopFuture<Void>)? = nil) -> EventLoopFuture<HTTP2StreamMultiplexer> { | ||
| return configureHTTP2Pipeline(mode: mode, initialLocalSettings: initialLocalSettings, position: position, targetWindowSize: 65535, inboundStreamStateInitializer: inboundStreamStateInitializer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: NIO prefers to use the explicit self keyword.
| return configureHTTP2Pipeline(mode: mode, initialLocalSettings: initialLocalSettings, position: position, targetWindowSize: 65535, inboundStreamStateInitializer: inboundStreamStateInitializer) | |
| return self.configureHTTP2Pipeline(mode: mode, initialLocalSettings: initialLocalSettings, position: position, targetWindowSize: 65535, inboundStreamStateInitializer: inboundStreamStateInitializer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem
| public func configureCommonHTTPServerPipeline( | ||
| h2ConnectionChannelConfigurator: ((Channel) -> EventLoopFuture<Void>)? = nil, | ||
| _ configurator: @escaping (Channel) -> EventLoopFuture<Void>) -> EventLoopFuture<Void> { | ||
| return configureCommonHTTPServerPipeline(h2ConnectionChannelConfigurator: h2ConnectionChannelConfigurator, targetWindowSize: 65535, configurator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same nit here:
| return configureCommonHTTPServerPipeline(h2ConnectionChannelConfigurator: h2ConnectionChannelConfigurator, targetWindowSize: 65535, configurator) | |
| return self.configureCommonHTTPServerPipeline(h2ConnectionChannelConfigurator: h2ConnectionChannelConfigurator, targetWindowSize: 65535, configurator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
|
@swift-nio-bot test this please |
|
@swift-nio-bot add to whitelist |
|
@swift-nio-bot test this please |
|
Can you run the |
|
@Lukasa If the request to run the |
|
@johnkassebaum CI claims it will generate this diff: |
…ity when creating stream channels. Motivation: Infow target window size constrains throughput. The default hardcoded 65535 is low for some use cases and so needs to be configrable. A TODO in the code stated 'Make configurable'. Modifications: - In HTTP2StreamMultiplexer, responding to a TODO where stream multiplexer creates a stream channel, created a multiplexr stored property to be used which is set in the default initilaizer. - In HTTP2PipelineHelpers, added versions of configureHTTP2Pipeline(..) and configureCommonHTTP2ServerPipeline that require an activeTargetWindow arg. Result: Clients, such as GRPCClient, can configure pipelines with targetWindowSizes to their liking.
docker/docker-compose.1804.53.yaml
Outdated
| image: swift-nio-http2:18.04-5.3 | ||
| build: | ||
| args: | ||
| base_image: "swiftlang/swift:nightly-master-bionic" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume this change was not supposed to come along?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh. Some confusion on my part it seems around being behind master. I will remove it
Lukasa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, LGTM.
|
@swift-nio-bot test this please |
|
Sorry if this appears as a noob question: When is the appropriate time to hit 'Update branch' button? |
|
Whenever suits you: but bear in mind that if you force-push to that branch again you can undo the update. |
|
That's what I observe, and which I just did. |
|
@swift-nio-bot test this please |
glbrntt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, looks good once the CI is green 👍
|
@swift-nio-bot test this please |
|
@swift-nio-bot test this please |
|
5.3 compiler crash is expected. |
Motivation: As part of apple#202 we added support for configuring the target window size of stream channels. That was plumbed through into outbound channels, but we missed the inbound ones, meaning that this only really worked for clients, not servers. That hardly seems fair! Modifications: Pass target window size to inbound channels too. Result: We can control target window size of inbound channels.
Motivation: As part of #202 we added support for configuring the target window size of stream channels. That was plumbed through into outbound channels, but we missed the inbound ones, meaning that this only really worked for clients, not servers. That hardly seems fair! Modifications: Pass target window size to inbound channels too. Result: We can control target window size of inbound channels.
Make multiplexer's
targetWindowSizeconfigurable and use configurability when creating stream channels.Motivation:
targetWindowSizeconstrains throughput. The default hardcoded65535is an unecessarily low limit that should be otherwise configrable. ATODOin the code stated as such.Modifications:
HTTP2StreamMultiplexer, responding to aTODOwhere stream multiplexer creates a stream channel, created a multiplexr stored property to be used which is set in the default initilaizer.HTTP2PipelineHelpers, added versions ofconfigureHTTP2Pipeline(..)andconfigureCommonHTTP2ServerPipeline(..)that require anactiveTargetWindowarg.Result:
Clients, such as
GRPCClient, can configure pipelines with targetWindowSizes to their liking.