-
Notifications
You must be signed in to change notification settings - Fork 42
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
src: Limit data frame payload size #111
Conversation
By limitting the data frame payload size one gains the following beneftis: 1. Reduce delays sending time-sensitive frames, e.g. window updates. 2. Minimize head-of-line blocking across streams. 3. Enable better interleaving of send and receive operations, as each is carried out atomically instead of concurrently with its respective counterpart. Limiting the frame size to 16KiB does not introduce a large overhead. A Yamux frame header is 12 bytes large, thus this change introduces an overhead of ~0.07%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, though I would prefer for this size to be configurable. It can then also be configurable in rust-libp2p
in an analogous way to the "split send size" that is configurable for libp2p-mplex
and currently defaults to 8KiB
after measurement results very similar to yours for yamux
. But I don't insist and leave it up to you.
Can you think of a scenario where one would want to configure the limit? |
If you consider your benchmark results to be representative in every case, then no. I just tend to be a bit more cautious in that different people may see a different optimum in different constellations and configurations of their networking stack and hence would allow them to experiment with this setting for themselves, should they want to do so. |
You are right, I do not. 7a77cfb makes the limit configurable. I tried to mirror the mplex naming while keeping the Yamux conventions. As you usually have a good eye for easy-to-grasp documentation, let me know if you have suggestions for alternative wording @romanb. |
Maybe not in terms of bandwidth, but at least the test |
By limitting the data frame payload size one gains the following
beneftis:
Reduce delays sending time-sensitive frames, e.g. window updates.
Minimize head-of-line blocking across streams.
Enable better interleaving of send and receive operations, as each is
carried out atomically instead of concurrently with its respective
counterpart.
Limiting the frame size to 16KiB does not introduce a large overhead. A
Yamux frame header is 12 bytes large, thus this change introduces an
overhead of ~0.07%.
See #100 (comment) and comments below that for details.
Might reduce probability for #104 to happen.