Skip to content
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

Feat: Incorporating Geographical Distance or Network Latency in DHT #75

Open
wei-b0 opened this issue Jul 28, 2023 · 3 comments
Open

Feat: Incorporating Geographical Distance or Network Latency in DHT #75

wei-b0 opened this issue Jul 28, 2023 · 3 comments
Labels
kind/enhancement New feature or request scope/nicetohave Nice to have feature going beyond go-libp2p-kad-dht

Comments

@wei-b0
Copy link

wei-b0 commented Jul 28, 2023

Hi,
I've been recently discussing a specific use-case scenario with the libp2p community that revolves around the concept of locality in DHT (Distributed Hash Table) and content routing. In our particular use-case, the geographical distance or network latency between nodes is of utmost importance and it's a key factor that we cannot afford to overlook.

Currently, as far as I'm aware, the libp2p.contentRouting.findProviders(CID) returns the closest nodes based purely on XOR distance between the CID and the peer-id. While this is great for most applications, it lacks the locality-preserving feature that would allow us to account for geographical distance or network latency.

It was suggested to me by yiannis in our conversation that these thoughts could be added as a feature request for the ongoing DHT refactoring work. Hence, I'm opening this issue.
Thanks,

@wei-b0
Copy link
Author

wei-b0 commented Jul 28, 2023

@yiannisbot

@iand
Copy link
Contributor

iand commented Jul 28, 2023

It should be possible to add latency as a signal as part of the routing table refresh algorithm (in addition to reachability). However this can leave the DHT open to eclipse attacks since an attacker can bring up enough new DHT nodes in close proximity to you to fill your routing table.

The existing go-libp2p-kbucket repository implements a peer diversity filter and we will likely incorporate something similar to ensure that buckets have a mix of peers. This is issue #49.

@iand iand added kind/enhancement New feature or request scope/nicetohave Nice to have feature going beyond go-libp2p-kad-dht labels Jul 28, 2023
@guillaumemichel
Copy link
Contributor

This repository is meant to provide the basic tools to build a DHT implementation. If you want to add ping distance in the routing algorithm, you can create a custom routing table taking ping distance into account when selecting the best peers to keep track of. You may also want to modify the server behavior when responding to lookup requests. Note that this repository isn't ready for production yet, and interfaces will certainly change.

I would like to add latency in the network simulator (in FakeRouter) so that developers can start experimenting with locality aware DHT implementations.

On the very long term, we would like IPFS to take ping distance into account during the routing process, but this isn't the immediate next step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request scope/nicetohave Nice to have feature going beyond go-libp2p-kad-dht
Projects
None yet
Development

No branches or pull requests

3 participants