-
Notifications
You must be signed in to change notification settings - Fork 233
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
Critical path towards DHT efficiency and performance #345
Comments
@raulk I've only just started contributing to DHT & am currently working on correctly implementing the DHT bootsrapping. That task combined with the reading of the DHT paper/meandering around the codebase should give me a fairly good idea of the DHT codebase. Please count me in as & when we start focusing on this epic. |
The routing table is currently a linear collection of kbuckets with increasing common-prefix-lengths, potentially resulting in significant contention for the first few k-buckets. Assuming that The original Kademlia recommends an LRU eviction policy for buckets filled to capacity, but libp2p-kad-dht only ever evicts disconnected or lost peers. With a value of Possible solutions would be to either a) maintain a replacement list alongside each kbucket for nodes which are waiting for entry to the kbucket, b) allow the first few k-buckets to have capacity larger than It would also help to periodically prune unreachable peers out of the routing table in a proactive manner. |
@aarshkshah1992 – hey, thanks for reaching out! #315 (PR for persisting the routing table) is heading in a good direction and would benefit from somebody pushing it over the finish line. Is this something that catches your attention? |
@raulk Perfect ! Please can you assign it to me ? Will get back with my comments as soon I've gone though the existing comments & code. |
@raulk What's next for us here ? Is there anything I can help with ? |
@raulk what does backtracing mean exactly? |
There are a few more interesting and proven ways to effectively do load balancing n structured P2P networks
|
True. I believe this is an artifact of operating in both Public & NAT'ed networks. The rule of thumb should be more like:
|
What about transports such as WebRTC? It might be wise to have a double rule that only peers that are "directly diable" (i.e. that any multiple nodes in the network can dial directly without any hole punching, WebRTC Stun and/or Relay dance) should ascend to the mainnet DHT. Grabbing a old illustration to make the point (not sure if it helps :)) Nodes should only "ascend" if they prove that they are willing and committed to provide a good service. |
Is there any work on this at the moment? |
This points to a score function for nodes, which is constantly updated based on node performance. There is plenty of literature related to this, but need to do a proper filtering.
An idea that has been thrown around off-band is to not only have routing table membership based on quality and performance (see above), but also latency to the node in the routing entry. This is a form of priority function, where the routing table is sorting entries according to node priority. It is more flexible than Coral, as it generalises the priority function and allows to include more parameters than the RTT only. |
Then thinking about it and digging a bit deeper, it turns out that this approach opens an attack vector to DHT k-bucket routing tables: if nodes sort entries in their buckets according to performance and are returning the top entries upon request (because of top performance), authors in [*] show that it only takes 2 different IP addresses in different /24 subnets to attack the Ethereum network and eclipse peers. This is because an attacker only needs to occupy the first position in every bucket (which is not expensive to do) - see Section IV and IV.A in particular. |
@yiannisbot AFAIK that paper's attack doesn't really apply to us at all. It's based on two assumptions:
If property 1 is true (as is assumed in S/Kademlia) then Kademlia can be Sybil attacked pretty easily without any countermeasures (e.g. expensive peerID generation, reputation, stake, etc.) However, if you choose to assume (as the ethereum folks did) that property 2 will save you from the problems of property 1, then the problems in the paper end up surfacing. Since we're not currently doing anything special with IP addresses the problems surfaced seem not particularly important (i.e. we have bigger Sybil attack problems to worry about). Additionally, I'm not really sure I understand why that attack should have worked on the Ethereum network. They are just trying to find some semi random distribution of peers to talk with, so why didn't they limit their peer connections to only 1 per /24 subnet (taking their assumption that having different IP addresses is very expensive as true, which 🤷♂)? If they did that then it seems like when an adversarial peer returns k peers very close to the lookup target that they'll all need to be in different /24 subnets which they deemed infeasible. |
EXTRA, EXTRA, most items on this epic are completed! Only these two are left:
|
@raulk I think this epic is probably safe to close. Is there anything that needs to be broken out into new issues? |
This issue outlines the critical issues to solve on the road towards a solid, robust and performant DHT implementation.
Snapshotter
andSeeder
, using bootstrap peers only as a fallback. Persist routing table #254 Explicitly set bootstrap/fallback nodes #295; WIP PR here: WIP: Persisting/seeding a routing table #315.We could potentially use the brand new libp2p testlab to continuously measure the impact of the changes we make.
If you're willing to help in pushing the DHT to new heights, please comment below ;-)
The text was updated successfully, but these errors were encountered: