Support multiple requests with single window ack on shared connection #1144
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.
Description
We are using flow control budget to manage multiple requests on shared connection from pool, so multiple small requests can successfully claim non-fragmented budget and send both requests.
They could arrive in any order in practice. When sent via TLS, there is potential for batching at encryption layer so a single window can be received to ack both requests in the aggregate.
When we distribute the flow control credit to each stream, we need to make sure not to over credit beyond the amount actually sent by each stream. Otherwise, we would not hit the condition to precisely ack the data sent by the first stream, and therefore it is not removed from the queue, blocking ack for all subsequent streams.
When this occurs, subsequent streams on the shared connection in the pool will eventually reach zero window and stall.
Also, when connection pool is disabled,
SASL
needs multiple requests to complete, so if a flush arrives on the group stream, queuing theSyncGroupRequest
, we need to make sure it is processed afterSaslAuthenticateRequest
etc.