-
Notifications
You must be signed in to change notification settings - Fork 691
Improve Http2Pool connection reuse for concurrent acquires #4051
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
base: main
Are you sure you want to change the base?
Conversation
419ed9b to
867cc89
Compare
867cc89 to
9a1af17
Compare
|
@violetagg I’ve rebased this PR on the latest main and included #4061. Could you please check it when you have a chance? |
9a1af17 to
6c758c4
Compare
|
@zimatars I think we should apply this also to the branch when a connection is established. What do you think? |
|
Hi @violetagg Thanks for the suggestion. I agree this should also cover the allocation path (when a connection is established). On the “connection is established” path, changing Proposed approach (drainLoop allocation decision)Instead of adding more logic to
Scenarios
If you think this approach makes sense, I'm happy to update the PR accordingly. |
|
@zimatars What do you think about pushing this as is and you will create a new PR for the connection established scenario? |
|
@violetagg I was planning to use the same drainLoop() allocation decision adjustment to cover both the existing-connection visibility window and the “connection is established” window. With that, I think the extra deliver(...) changes in my commit can be reverted (keeping the main/#4061 deliver semantics unchanged) and we can keep the PR focused on the drainLoop() side. Would that be acceptable? |
|
ok |
Signed-off-by: zimatars <[email protected]>
Signed-off-by: zimatars <[email protected]>
6c758c4 to
20b048f
Compare
|
@violetagg I’ve pushed an updated implementation in this PR. I reverted the earlier
Changes in
|
This PR is for issue #4050 .
When using HTTP/2, concurrent requests should prefer multiplexing on an existing connection (until max concurrent streams is reached). There is a timing window in
Http2Pool#drainLoopwhere a selected slot is temporarily not visible to other borrowers until the async deliver runs on the Channel EventLoop. During that window, concurrent acquires may allocate an extra connection.Change: Reserve stream capacity and re-offer the selected slot before scheduling the async deliver, so concurrent borrowers can still see and reuse the connection.