Skip to content

Conversation

@qusc
Copy link
Contributor

@qusc qusc commented Jul 17, 2021

... in order to circumvent the limitation of a maximum of 100 concurrent calls as imposed by the default settings of NIOHTTP2Handler.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 17, 2021

CLA Signed

The committers are authorized under a signed CLA.

…n to circumvent the limitation of a maximum of 100 concurrent calls as imposed by the default settings of NIOHTTP2Handler
Copy link
Collaborator

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, this broadly looks good! I left a few notes inline but I think we'll also want a test for this. It could do something like:

  1. start a server setting max concurrent streams to N (where N > 100)
  2. connect to the server
  3. start N client streaming (or bidirectional streaming) RPCs
  4. send a message on each RPC (but do not send end)
  5. send end on RPC N
  6. wait for the status on RPC N (i.e. if this RPC does not complete then we didn't apply the setting correctly)
  7. send on all other RPCs, wait for them to complete

Comment on lines 89 to 94
@discardableResult
public func with(httpMaxConcurrentStreams: Int) -> Self {
self.configuration.httpMaxConcurrentStreams = httpMaxConcurrentStreams
return self
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be moved down the file next to withHTTPTargetWindowSize(_:) and be named in a similar way?

connectionIdleTimeout: TimeAmount = .nanoseconds(.max),
messageEncoding: ServerMessageEncoding = .disabled,
httpTargetWindowSize: Int = 65535,
httpMaxConcurrentStreams: Int = 100,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't add this here since it breaks public API -- moreover this init is deprecated anyway (It was deprecated such that we no longer have to deprecate and add new inits every time we add a new property to the configuration).

public var httpTargetWindowSize: Int = 65535

/// The HTTP/2 max number of concurrent streams. Defaults to 100.
public var httpMaxConcurrentStreams: Int = 100
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a precondition in willSet that the new value must be >= 0? (And document the requirement)

/// The HTTP/2 flow control target window size. Defaults to 65535.
public var httpTargetWindowSize = 65535

public var httpMaxConcurrentStreams: Int = 100
Copy link
Collaborator

Choose a reason for hiding this comment

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

We actually don't need this setting on the client configuration: the setting indicates to the other side how many streams they may create concurrently. I.e. here we're configuring how man the streams the server may create but for gRPC all streams are created by the client.

@qusc
Copy link
Contributor Author

qusc commented Jul 20, 2021

@glbrntt awesome, thanks for your comments, let me know what you think about my changes

Copy link
Collaborator

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

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

This looks great! We're just missing a bit of resource cleanup in the tests then this should be good to go.

Copy link
Collaborator

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

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

Great, thank you @qusc! 🙏

@glbrntt glbrntt added the 🆕 semver/minor Adds new public API. label Jul 20, 2021
@glbrntt glbrntt merged commit 46021d0 into grpc:main Jul 20, 2021
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.

2 participants