python-hyper / h2

HTTP/2 State-Machine based protocol implementation
https://h2.readthedocs.io/en/stable
MIT License
963 stars 151 forks source link

Configure receive window size for auto flow control #1280

Open jonathanslenders opened 8 months ago

jonathanslenders commented 8 months ago

When using auto flow control through acknowledge_receive_data, is there a way to configure the receive window (for both the connection and the stream)?

I know that we can set the INITIAL_WINDOW_SIZE for streams, and the WindowManager will use this setting for the max window size. Unfortunately, at the connection level, the window size remains pretty small, I think at 64k.

We're in a situation with higher than usual round-trip-times, so, I'd like to increase window sizes, but still use auto flow control if possible.

jonathanslenders commented 8 months ago

There is a solution I found that seems to work:

That seems to do the job. I'm somewhat confused by this, wondering whether it's the right approach. The docs about "Auto Flow Control" make it seem like we no longer have to call increment_flow_control_window, but only acknowledge_received_data However, it looks like if we want a larger window, we have to both change the INITIAL_WINDOW_SIZE setting, and still call increment_flow_control_window once for the connection. Is this correct?

sethmlarson commented 8 months ago

I haven't dug in whether that's a safe way to do things. This seems like a useful feature though, being able to configure the connection level window separate from initial stream windows.