Skip to content
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

Use larger stream window #192

Closed
edsko opened this issue Jul 17, 2024 · 1 comment · Fixed by #214
Closed

Use larger stream window #192

edsko opened this issue Jul 17, 2024 · 1 comment · Fixed by #214
Assignees
Labels
http2 Problems in `http2` and related packages performance Performance related issues priority: medium Should be done before the library can be considered complete

Comments

@edsko
Copy link
Collaborator

edsko commented Jul 17, 2024

Since kazu-yamamoto/http2#130 we no longer have a limited number of workers, but instead have one thread per stream. This means that the warning in network-control

If you use a smaller connection window size, you must ensure that if you are handling fewer concurrent streams than allowed by defaultMaxStreams, that the unhandled streams cannot exhaust the connection window, or risk the entire system deadlocking.

no longer applies (the emphasized if is no longer true). We should therefore set the stream window size to something larger (256 kB?), with a smaller connection window (2 MB?). This should result in fewer WINDOW_UPDATE frames sent.

We should verify this reasoning and check that this does not ensure deadlock.

While we're at it: the numberOfWorkers parameter of http2, mirrored as settingsNumberOfWorkers in http2-tls are both redundant. We should submit PRs to remove them.

@edsko edsko added priority: medium Should be done before the library can be considered complete performance Performance related issues http2 Problems in `http2` and related packages labels Jul 17, 2024
@FinleyMcIlwaine
Copy link
Collaborator

I tested the suggested 256KiB initial stream window and 2MiB connection window size against the old defaults (64KiB stream window and 128*64KiB connection window) in a bidirectional streaming example. As expected, we get significantly fewer window updates with the larger stream window.

Wireshark http2 stats with (new) stream window 256KiB and 2MiB connection window:

================================================================================================================================
HTTP2:
Topic / Item     Count         Average       Min Val       Max Val       Rate (ms)     Percent       Burst Rate    Burst Start
--------------------------------------------------------------------------------------------------------------------------------
HTTP2            200340                                                  16.6476       100%          19.5900       8.070
 Type            200340                                                  16.6476       100.00%       19.5900       8.070
  WINDOW_UPDATE  332                                                     0.0276        0.17%         0.0600        0.624
  SETTINGS       4                                                       0.0003        0.00%         0.0400        0.000
  HEADERS        3                                                       0.0002        0.00%         0.0200        0.000
  DATA           200001                                                  16.6194       99.83%        19.5600       8.070

--------------------------------------------------------------------------------------------------------------------------------

Wireshark http2 stats with (old) stream window 64KiB and 64*128KiB connection window:

================================================================================================================================
HTTP2:
Topic / Item     Count         Average       Min Val       Max Val       Rate (ms)     Percent       Burst Rate    Burst Start
--------------------------------------------------------------------------------------------------------------------------------
HTTP2            201348                                                  17.0441       100%          18.5400       34.285
 Type            201348                                                  17.0441       100.00%       18.5400       34.285
  WINDOW_UPDATE  1340                                                    0.1134        0.67%         0.1400        31.375
  SETTINGS       4                                                       0.0003        0.00%         0.0400        29.114
  HEADERS        3                                                       0.0003        0.00%         0.0200        29.115
  DATA           200001                                                  16.9300       99.33%        18.4200       34.285

--------------------------------------------------------------------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http2 Problems in `http2` and related packages performance Performance related issues priority: medium Should be done before the library can be considered complete
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants