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
perf(discv5): populate kbuckets & improved RLPx peering #7683
Conversation
closed in favour of #7695 |
will still be useful to reverse this, to iteratively get closer to own node id |
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.
Am I understanding correctly that this code is supposed to get discv5 to return a specific distance internally since it uses self.local_key.distance(target)
? But instead of doing it for all log2 up to 255, we do it for half?
exactly. it's unlikely to find peers for the closest buckets, 0-127. I think we should eventually extend it to cover all buckets though, if not already do that now tbh. |
Metrics on outgoing RLPx connections back the hypothesis that pseudorandom FINDNODE target selection, explicitly targeting each kbucket, is more beneficial over time than a completely random target in lookup queries that aim to discover RLPx peers. Outgoing RLPx connections are important for nodes behind NAT to be successful, as @joshieDo has been strongly advocating for this week. This pr was run between 16.04 21:30 - 17.04 12:30, although targeting all kbuckets, not only the top half (half furthest away from local node id as latest commit decreased it to in fear of too much overhead targeting all). Between 17.04 19:30 - 18.04 19:30, the node was ran with target generated by This panel shows the number of successfully established outgoing RLPx connections over time. Furthermore, pseudorandom target selection targeting each kbukcet is also cheaper than random target selection, as it leads to less peer churn. Based on these metrics, I will increase the targeted kbucket range in the lookup query to stretch over the whole kbucket range, since peer churn is less than the completely random target selection commonly used. |
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.
lgtm, thanks for the additional docs and explanation with metrics!
kinda got the "metrics or go home" mentality from you guys |
Improves bootstrapping by starting to fill kbuckets at furthest log2distance from local node id, as these are easier to fill.