-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
proposal: use Happy Eyeballs-like logic for dialing peers #1785
Comments
Thank you for writing this down @marten-seemann. In regards to the open questions, I think Probe Lab (//CC @yiannisbot and @dennis-tra) could be a big help providing data and recommendations. Long term, I think rust-libp2p should follow the learnings and strategy of go-libp2p, thus I would be in favor of this making it into libp2p/specs as a guideline for other implementations eventually. What do you think?
First indicators could be:
Related discussion in rust-libp2p libp2p/rust-libp2p#1896. |
You need some smarts to avoid breaking hole punching of you go down that route. |
Indeed. I think we can afford to hole punch in parallel in the first iteration. That's probably not too bad. When we're at the point where we've decided to hole punch, we might as well pay the cost of a few parallel dials. If we wanted to apply a similar logic to hole punches, we'd need some kind of mechanism to negotiate the order of the addresses, as well as the timeouts. This could be done by adding this information to the hole punch protobuf, but that's definitely a larger change. |
Happy Eyeballs, defined in RFC 8305, specifies how to dial a server that one has an IPv4 and an IPv6 address for: In order to not overload the network, the IPv6 address should be dialed first, and if no connection can be established within 250ms, another dial attempt using IPv4 should be started in parallel. The application will use whatever connection is established first.
Why?
We're in the process of adding more transports. As more and more upgrade, we can expect their list of advertised addresses to grow. libp2p/specs#353 will further increase the number of addresses. It puts a lot of load on our node, on the network and on the peer to dial all these addresses in parallel. We need to be smart and dial addresses such that 1. we end up with a connection over a transport that we prefer and 2. we have a high probability of successfuly connecting on the first or second connection attempt.
Differences from RFC 8305
Proposed address ranking algorithm
Preprocessing: Bucket addresses into local / internet-wide addresses (⇒ 2 buckets). For every bucket, run:
Open Questions
Possible optimizations
The text was updated successfully, but these errors were encountered: