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

implement a proper relay v2 search strategy #9257

Open
Jorropo opened this issue Sep 8, 2022 · 3 comments
Open

implement a proper relay v2 search strategy #9257

Jorropo opened this issue Sep 8, 2022 · 3 comments
Labels
effort/days Estimated to take multiple days, but less than a week exp/wizard Extensive knowledge (implications, ramifications) required kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now topic/libp2p Topic libp2p

Comments

@Jorropo
Copy link
Contributor

Jorropo commented Sep 8, 2022

Description

Our current relay search is pretty bad.
It just constantly poll our K cluster with some exp-backoff.

The goal of this is to avoid convergence on a few nodes and spread the relaying load more or less evenly on all reachable dhtservers.

However the actual strategy we were supposed to implement is an outward search until success. If no nodes in our K cluster support relaying, it probably will never change.

Maybe a random polling of the DHT is not that bad after all ?

API

Currently this is implemented with a long running task, this would need to be rewriten to be statefull and executing in the libp2p callback.

@Jorropo Jorropo added kind/enhancement A net-new feature or improvement to an existing feature topic/libp2p Topic libp2p exp/wizard Extensive knowledge (implications, ramifications) required P3 Low: Not priority right now effort/days Estimated to take multiple days, but less than a week labels Sep 8, 2022
@lidel
Copy link
Member

lidel commented Sep 9, 2022

Some notes for the future:

  • bump go-libp2p v0.22.0 & go1.18&go1.19 #9244 switched to go-libp2p v0.22 which is no longer expecting Kubo to inform go-libp2p about new peers via periodically push, but instead go-libp2p performs a pull via defined peer source func, and does it only when needed.
    • autorelay.WithPeerSource is wired up here, but it uses the old autoRelayFeeder from here.
      • This "feeder" was designed around periodically informing libp2p about new peers (Kubo pushing new peers to go-libp2p), which is no longer how things work, and is probably wasteful.
  • relayFinder from go-libp2p 0.22 will ask peerSource func for more and more peers in batches of maxCandidates until findNodes finds a relay. This opens some questions:
    • Should Kubo keep a state about what was provided via peerSource?
    • Should we send Peering.Peers first? (if any)
    • Should we trigger a random DHT walk if all known peers are already sent, but go-libp2p asks for more?

@lidel lidel moved this to 🥞 Todo in IPFS Shipyard Team Sep 9, 2022
@Jorropo
Copy link
Contributor Author

Jorropo commented Sep 10, 2022

Should we trigger a random DHT walk if all known peers are already sent, but go-libp2p asks for more?

No in theory this isn't good because it would lead to network convergence on better nodes.
In theory a outward DHT search is better

Should Kubo keep a state about what was provided via peerSource?

I think so else how do you know how wide do you need to hit ?

@Jorropo
Copy link
Contributor Author

Jorropo commented Sep 10, 2022

Actually we don't need an outward DHT search, we just need a repeatable random pattern (for example hashing the previous key searched).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/days Estimated to take multiple days, but less than a week exp/wizard Extensive knowledge (implications, ramifications) required kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now topic/libp2p Topic libp2p
Projects
No open projects
Status: 🥞 Todo
Development

No branches or pull requests

2 participants