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

Write coalescing #633

Closed
vyzo opened this issue May 11, 2019 · 2 comments
Closed

Write coalescing #633

vyzo opened this issue May 11, 2019 · 2 comments

Comments

@vyzo
Copy link
Contributor

vyzo commented May 11, 2019

We have observed in the relay infrastructure that almost all libp2p writes are tiny. This creates a throughput and performance problem, as it results in sending many more packets than necessary, falling way short of maximum throughput as our packets are mostly empty.
In addition, the number of syscalls is elevated, which reduces software performance.

In an experiment with a relay using libp2p/go-mplex#54, it was observed that the inbound throughput increased while the outbound packet rate decreased drastically, to almost 60% of inbound packet rate.

In continuation of discussion in libp2p/go-mplex#54, I would like to propose a write coalescing component, that sits between the security module and the multiplexer Why there? it greatly reduces the overhead of the security module from the length/mac -- yes, our writes are so small that this is a real problem.

The module could be optional (eg turned on in relays only) or it could be permanent with a change in the stream interface.
The problem is that not all protocols are okay with the coalescing delay, as some of them are time-sensitive (eg: ping) or real-time.
To overcome this, the module could provide a WriteNoDelay method to be used by multiplexers, and the method could be exposed via options given at stream creation time.
In this manner, real-time protocols could create their streams with a OpenStream(NoDelay) option, thus enabling writes to this stream to avoid the coalescing delay.

cc @Stebalien @whyrusleeping @raulk @marten-seemann

@Stebalien
Copy link
Member

We'll need direct multiplexer support for something like WriteNoDelay. But I agree we should do it.

@jacobheun
Copy link
Contributor

This work was completed although we've recently disabled it in #867 until we've performed further testing/profiling. I am going to close this and open a new issue to track re-enabling it for mplex and yamux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants