kazu-yamamoto / http2

HTTP/2.0 library including HPACK
BSD 3-Clause "New" or "Revised" License
84 stars 22 forks source link

`http2` sends lots of small window size updates for the connection #129

Closed edsko closed 2 months ago

edsko commented 3 months ago

For individual streams we get a window update only once we have exhausted half the available window size, but this does not appear to be the case for the connection, where we are getting many small window updates (20 bytes here, 30 bytes there..). In some of our test cases a full 13% of frames were window updates.

Perhaps there are good reasons for preferring many window updates on the connection, but if so, perhaps this should be configurable?

Creating this issue here mostly as a way to keep track of this problem; we are not blocked on this (and we may attempt a fix at some point ourselves).

kazu-yamamoto commented 3 months ago

Connection window should behave as the same as stream window. So, this is a bug.

kazu-yamamoto commented 3 months ago

I tested this with h2c-client -t and h2c-server. I don't see any window updates which contain small values.

Stream window and connection window use the same logic: https://github.com/kazu-yamamoto/http2/blob/22c2df9f7f33227ac24201480aea1dd00c85a65e/Network/HTTP2/H2/Window.hs#L72

So, if stream window works well, connection window should work well.

edsko commented 3 months ago

Hm, thanks for looking into this! We might see if we can take a closer look ourselves to see why we are seeing this in our test case.

kazu-yamamoto commented 3 months ago

The difference of connection window and stream window is that stream window is manipulated by a single thread while connection window is modified by multiple threads. I guess you are seeing a race.

kazu-yamamoto commented 2 months ago

@edsko Do you see this issue at this moment?

kazu-yamamoto commented 2 months ago

Closing.