Prefer low-rtt announce relays#261
Open
marcus-pousette-hp wants to merge 3 commits 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.
Prefer lower-RTT announce relays within a small DHT-distance candidate window.
In public-DHT testing this reduced average connect-open time by 117ms (~6%) and p95 connect-open time by 275ms (~11%), while selected relay RTT p95 dropped from 242ms to 37ms.
Previously the announcer used the first 3 closest replies directly, but with this PR: It keeps DHT locality by only considering the first 8 closest replies, then selects the 3 lowest-RTT candidates from that window.
The old behavior could pick high-latency rendezvous relays even when lower-latency candidates were already available nearby.
Testing
Som unit tests where added also below a Public DHT experiment was performed.
Public DHT experiment
Ran public-DHT holepunch attempts using hosted VMs, with both peers forced to
firewalled: trueso the consistent holepunch path was exercised.Branch comparison, 30 attempts per branch:
mainfix/rtt-aware-announcer-relaysWindow comparison, 30 attempts per window:
Selected RTTis the RTT from the announcing node to the DHT nodes selected as announce/rendezvous relays.Rankis the selected node position inclosestReplies; lower rank means closer to the DHT target.Window
8(and what this PR chooses as the default value now), is a conservative cutoff: it captures most of the selected-RTT improvement over the current behavior, while avoiding the larger DHT-rank drift seen with bigger windows.Co-written with AI