x/net/http2: Server window updates are too chatty #54730
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
First, thank you all for the work that you do implementing and maintaining an excellent H2 library! Working with Go to implement a protocol over H2 is an absolute dream because of the work that you do!
In our use case (an implementation of the new proposed IETF RPM protocol for measuring responsiveness under working conditions) we make heavy use of the POST capabilities of the server implementation in H2. What we have noticed is that the
Server
code is a little too chatty sending per-connection and per-stream window update messages.We know why this behavior happens. Not that you need to hear this (you implemented it, after all), but for the sake of completeness, here is our understanding:
pipe
(ultimately) connectsgo
function that reads frames from the wire that the client is sending (this will call theWrite
method on thepipe
); andRead
on therequestBody
(this will call theRead
method on thepipe
)Read
on thepipe
blocks on a condition variable that is signaled by theWrite
side of thepipe
whenever data is sent in to the pipe.Write
-side of thepipe
happens every time a data frame is received,Write
s putMaxReadFrameSize
(approximately 16k) bytes in to the pipe at a time.MaxReadFrameSize
bytes put in to thepipe
, the condition variable is signaled whichRead
blocked in the user-supplied handler.Read
usually unblocks before another frame is read from the wire (no matter how fast you can push data along the wire).MaxReadFrameSize
bytes at a time from the request body (and that is after optimization [NB: In our application we discard the bytes pushed by the server and evenio.Discard
is too timid in this respect! (yes, I am running out nested bracket sigils!)]).serverConn.noteReadFromBodyHandler
is invoked which (ultimately) triggers an unconditional window update for both the stream and the connection.Whew. Sorry for the word salad! I hope that is legible and reasonable.
According to the H2 spec:
The quoted RFC encourages window updates only be sent when they expand the buffer by 1/2 the window size. [p 98[(https://www.rfc-editor.org/rfc/rfc1122.html#page-98).
We propose that the server implementation of the H2 library be modified to work in this fashion. We are accompanying this proposal (which we hope is following the proper procedures!) with a patch to implement the behavior. The patch does not add additional public APIs -- we think that's a plus.
Again, thank you so much for all the work that you put in to creating and maintaining this excellent library and we hope that this proposal and patch are helpful.
Sincerely,
Will
The text was updated successfully, but these errors were encountered: