-
Notifications
You must be signed in to change notification settings - Fork 226
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
Terminate Queries Correctly #290
Comments
Interesting... we should apply the same logic to timing out on IPNS queries but that's less of an issue. I'm a bit worried that we'll end up going down a bunch of dead-end paths due to how many undialable nodes we have in the DHT but maybe that's not an issue. It's something we can test pretty easily. |
GetClosestPeers()
determinasticallyGetClosestPeers()
return more intelligently
Actually, we shouldn't be using the (I'm getting close to a working implementation, I'll post a patch when I'm done) |
This is actually still incorrect. We _should_ be limiting our query to AlphaValue peers and then expanding to KValue peers once we run out of peers to query. However, this is still much better and we can do that in a followup commit. Considerations: We may not want to merge this until we get the multipath lookup patch. It turns out, our current DHT effectively explores _all_ paths. fixes #290
This is actually still incorrect. We _should_ be limiting our query to AlphaValue peers and then expanding to KValue peers once we run out of peers to query. However, this is still much better and we can do that in a followup commit. Considerations: We may not want to merge this until we get the multipath lookup patch. It turns out, our current DHT effectively explores _all_ paths. fixes #290
@Stebalien I'm looking into making this same change in the js-land DHT. Could you explain your last comment a little more - I'm not sure I understand the difference from what @raulk is proposing? |
Basically, I'm just proposing that we actually implement kademlia. Don't try understanding the go DHT, just read that paper. |
For posterity I will quote the relevant section of the Kademlia paper, which is a little confusing but I think it's basically saying the same thing as you described above:
|
GetClosestPeers()
return more intelligentlyGetClosestPeers()
return more intelligently (cutoff/termination criteria)
This is actually still incorrect. We _should_ be limiting our query to AlphaValue peers and then expanding to KValue peers once we run out of peers to query. However, this is still much better and we can do that in a followup commit. Considerations: We may not want to merge this until we get the multipath lookup patch. It turns out, our current DHT effectively explores _all_ paths. fixes #290
This is actually still incorrect. We _should_ be limiting our query to AlphaValue peers and then expanding to KValue peers once we run out of peers to query. However, this is still much better and we can do that in a followup commit. Considerations: We may not want to merge this until we get the multipath lookup patch. It turns out, our current DHT effectively explores _all_ paths. fixes #290
GetClosestPeers()
return more intelligently (cutoff/termination criteria)
Tackling this in #436 |
Related to #287.
GetClosestPeers()
will return in either of two conditions:IIUC:
We traverse the network by creating a heap of peers ordered by the XOR distance function to the key, and sending the query in ascending order of distance (i.e. closest to furthest).
In all cases we are looking for at most
KValue
peers, but the algorithm does not take this into account. We should stop after we've encountered a slice ofKValue
peers such that all remaining unqueried ones are worse than the set we already have (i.e. furthest away from the key).What's happening now is that we zero in to the region of the DHT thanks to the heap, and then zoom back out because we have no stop condition, only to later select the peers we initially zeroed in on.
CC @Stebalien
Edit (@jacobheun):
Design notes
According to Kademlia, a query terminates when it finds the K (20) closest peers to the target key. Specifically:
However, there are a few tricks/options (output of many discussions with Adin):
The "dial queue": For the moment, we will be removing the dial queue to speed up experimentation. Given the current WIP implementation and all the suggested improvements above, we'd expect fewer parallel dials so the dial queue may not be necessary. Once we've taken concrete measurements and compared the current DHT with the experimental patches, we can determine if we need to put it back in.
Testing mechanics
Success Criteria
The text was updated successfully, but these errors were encountered: