Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Peer Friends #2288

Closed
3 tasks
alanshaw opened this issue Jul 22, 2019 · 6 comments
Closed
3 tasks

Peer Friends #2288

alanshaw opened this issue Jul 22, 2019 · 6 comments
Assignees
Labels
exp/expert Having worked on the specific codebase is important exploration kind/resolved-in-helia P3 Low: Not priority right now status/ready Ready to be worked

Comments

@alanshaw
Copy link
Member

alanshaw commented Jul 22, 2019

Can we come up with a solution and track progress on peer "friends" in IPFS?

What is that?

The idea is that friendly peers maintain a persistent connection with each other that is immune from connection manager GC.

Why is it useful?

  1. Preload nodes used by JS IPFS will preload content but are not useful to the JS IPFS node if it is not connected to them
  2. The IPFS gateway could really use a persistent connection to the cluster nodes (currently a cron job calling swarm.connect)
  3. Probably lots of applications using IPFS would like to stay connected to a minimum set of nodes

What would need to happen?

Proposal (open to suggestions/changes):

  • Ability to dial a node and flag that the connection is "high priority"
    • Should be established ASAP
    • Always re-establish if dropped
    • Be immune from connection manager GC
  • Config option to specify multiple friendly peers
    • Addresses.Friends
  • Startup task to dial all the friendly peers

@lidel @Stebalien @daviddias @jacobheun @raulk @olizilla

@lidel
Copy link
Member

lidel commented Jul 22, 2019

Relevant prior art form go-ipfs: v0.4.20 shipped a concept of "important" connections:

The ipfs swarm connect command has a few new features:

It now marks the newly created connection as "important". This should ensure that the connection manager won't come along later and close the connection if it doesn't think it's being used.

@jacobheun
Copy link
Contributor

I created an issue in js-libp2p that discusses peer tagging to achieve this, libp2p/js-libp2p#369. We could take the list from Addresses.Friends and tag them as "important" so we can get the auto connect and connection "permanence" logic in place.

Another approach I started thinking about was adding support for definable topologies. While more generic, I think they could serve this use case as well.

@daviddias
Copy link
Member

I suggest calling this config value something more informative than Friends. Nothing occurs now though 😅

The Conn Manager should be the piece of code that handles this.

Note, today you can achieve 90% of this today by adding these peers to the Bootstrap list, as it will try to reconnect if the connection got dropped every 10s https://github.com/libp2p/js-libp2p-bootstrap/blob/master/src/index.js#L40 (the other 10% is because the connections do get dropped, which means you need to pay the cost of dialing again)

@alanshaw alanshaw added exp/expert Having worked on the specific codebase is important exploration P3 Low: Not priority right now status/ready Ready to be worked labels Jul 22, 2019
@jimpick
Copy link

jimpick commented Jul 22, 2019

"Bungee Cord Peers" ?

@jbenet
Copy link
Member

jbenet commented Jul 24, 2019

Related: ipfs/kubo#6097 (comment)

@achingbrain
Copy link
Member

achingbrain commented May 31, 2023

js-ipfs is being deprecated in favor of Helia. You can #4336 and read the migration guide.

This can be accomplished by tagging friend peers with the KEEP_ALIVE tag imported from @libp2p/interface-peer-store/tags.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important exploration kind/resolved-in-helia P3 Low: Not priority right now status/ready Ready to be worked
Projects
No open projects
Status: Done
Development

No branches or pull requests

7 participants