-
Notifications
You must be signed in to change notification settings - Fork 954
Ensure HTTP/2 flow control to work at the stream level #6266
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
Motivation: Since `InboundTrafficController` operates at the TCP level, it isn't aligned with HTTP/2 flow control. As a result, a stream may receive more than its stream window size allows and interfering with other streams from recieving data. Related: line#6253 Modifications: - Integrated `InboundTrafficConroller` with HTTP/2 `Http2LocalFlowController` - Invokes `Http2LocalFlowController.consumeBytes()` when steam data is consumed to send a `WINDOW_UPDATE` frame. - Introduced `{ServerBuilder,ClientFactoryBuilder}.http2StreamWindowUpdateRatio` to customize the threshold to send WINDOW_UPDATE frames. - Fixed `client.Http2ResponseDecoder` and `serer.Http2RequestDecoder` to defer reporting the consumed data length. - The length is not reported via `InboundTrafficController` when the data is consumed in userland. Result: - Fixed a bug where HTTP/2 flow control did not work properly, and stream-level windowing was ignored. - Closes line#6253 Co-authored-by: Yizhou Feng <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6266 +/- ##
============================================
+ Coverage 74.46% 74.57% +0.11%
- Complexity 22234 22476 +242
============================================
Files 1963 1985 +22
Lines 82437 83079 +642
Branches 10764 10787 +23
============================================
+ Hits 61385 61957 +572
- Misses 15918 15967 +49
- Partials 5134 5155 +21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Understood the main change is http2 flow control is updated when the request/response corresponding to the stream is consumed instead of immediately at onDataRead
core/src/main/java/com/linecorp/armeria/client/HttpClientPipelineConfigurator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/internal/common/InboundTrafficController.java
Outdated
Show resolved
Hide resolved
Note: I understood that if users are not interested in the server request or client response (fire-and-forget pattern), then the window frame won't be sent. I think most users won't be using this pattern since, but something to keep in mind in case someone asks about this behavior after applying this patch. |
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.
👍 👍 👍
core/src/main/java/com/linecorp/armeria/client/ClientFactoryBuilder.java
Show resolved
Hide resolved
From what I understand, Armeria requires users to consume all |
hi @trustin could you review it, thanks! |
Motivation:
Since
InboundTrafficController
operates at the TCP level, it isn't aligned with HTTP/2 flow control. As a result, a stream may receive more than its stream window size allows and interfering with other streams from receiving data.Related: #6253
Modifications:
InboundTrafficController
with HTTP/2Http2LocalFlowController
Http2LocalFlowController.consumeBytes()
when steam data is consumed to send aWINDOW_UPDATE
frame.{ServerBuilder,ClientFactoryBuilder}.http2StreamWindowUpdateRatio
to customize the threshold to send WINDOW_UPDATE frames.client.Http2ResponseDecoder
andserver.Http2RequestDecoder
to defer reporting the consumed data length.InboundTrafficController
when the data is consumed in userland.Result: