perf: raise default max frame size to 64 KiB - #272
Open
anmonteiro wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Config.read_buffer_size/ advertisedSETTINGS_MAX_FRAME_SIZEfrom16 KiBto64 KiBWhy
On the large-upload benchmark, the server was still advertising the protocol-minimum
MAX_FRAME_SIZE(16 KiB). That forces clients such as curl/nghttp2 to fragment a1.5 GiBupload into a very large number of DATA frames, which amplifies parser, flow-control, and write-loop overhead.64 KiBwas the best point I measured locally on this workload:16 KiB: much slower64 KiB: best throughput256 KiBand1 MiB: slightly worse againSo this is not just “bigger is better”;
64 KiBlooks like the right default tradeoff here.Validation
dune build --display=short @runtest-test_h2 @runtest-test_h2_client @runtest-test_h2_server spec/eio_h2spec.exeBenchmark
Using the existing
1.5 GiBcurl upload benchmark against the Eio server, with the same localglutencheckout in both variants:perf/batch-window-updates):3.391s,452.94 MiB/s;3.409s,450.62 MiB/s64 KiBdefault max frame size:0.813s,1890.22 MiB/s;0.799s,1921.55 MiB/sThis is roughly a
4.2xthroughput improvement on this workload.Notes
This changes the default connection preface behavior: default connections now send a non-empty SETTINGS frame advertising a larger
MAX_FRAME_SIZE. The tests updated here cover the two places that were implicitly assuming the old16 KiBdefault.