elixir-mint / mint

Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2 🌱
Apache License 2.0
1.36k stars 106 forks source link

Avoid unnecessary `WINDOW_UPDATE` frames in HTTP/2 client #432

Open v0idpwn opened 2 months ago

v0idpwn commented 2 months ago

In the current implementation, Mint automatically "refills" window sizes for both the stream and the connection whenever it receives data frames. This approach, while functional, leads to the generation of excess traffic due to frequent and possibly unnecessary WINDOW_UPDATE frames.

A more efficient approach is seen in :gun, which employs some heuristics to determine when sending WINDOW_UPDATE frames is actually needed. I suggest implementing a similar strategy in Mint as an optimization.

whatyouhide commented 2 months ago

@v0idpwn sure we can do that. The HTTP/2 spec says to refill whenever you get data IIRC, but yeah we can try and be smarter. Wanna make a PR for this? I will not have time for a while and this is not high prio given everything technically works.