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

Tag mesh peers on graft, remove tags on prune #380

Closed
achingbrain opened this issue Dec 6, 2022 · 4 comments · Fixed by #383
Closed

Tag mesh peers on graft, remove tags on prune #380

achingbrain opened this issue Dec 6, 2022 · 4 comments · Fixed by #383

Comments

@achingbrain
Copy link
Collaborator

To prevent the connection manager pruning connections to high-value peers, modules that need connections to certain peers should tag them to ensure they don't get culled by the connection manager when connection limits have been specified and reached.

When this module grafts mesh peers for a given topic, it should use the peerStore.tagPeer method to tag them with a value:

libp2p.peerStore.tagPeer(peerId, 'gossipsub-mesh-peer', {
  value: 100 // value should be 0-100
})

When they are pruned from a mesh peerStore.unTagPeer should be used:

libp2p.peerStore.unTagPeer(peerId, 'gossipsub-mesh-peer')

Refs: libp2p/js-libp2p#369

@dapplion
Copy link
Contributor

dapplion commented Dec 7, 2022

Do other implementations have this feature? I don't recall seeing it. Speaking for Lodestar we have more complex logic to decide the value of the peer so this feature won't be useful at all. Gossipsub also has it's own scoring system, which indirectly affects if a peer is meshed or not tho.

@achingbrain
Copy link
Collaborator Author

Do other implementations have this feature? I don't recall seeing it.

See the referenced issue in the OP for context.

Speaking for Lodestar we have more complex logic to decide the value of the peer

If that's the case lodestar may wish to tag high value peers as well.

@dapplion
Copy link
Contributor

dapplion commented Dec 7, 2022

If that's the case lodestar may wish to tag high value peers as well.

If I understand this feature is relevant because the connection manager may choose to disconnect peers at will right? Can consumers completely disable that so peer management is done 100% by the consumer?

@achingbrain
Copy link
Collaborator Author

achingbrain commented Dec 7, 2022

Yes, just leave maxConnections and maxEventLoopDelay as the default (both Infinity).

maschad added a commit to maschad/js-libp2p-gossipsub that referenced this issue Dec 14, 2022
maschad added a commit to maschad/js-libp2p-gossipsub that referenced this issue Feb 7, 2023
maschad added a commit to maschad/js-libp2p-gossipsub that referenced this issue Feb 7, 2023
maschad added a commit to maschad/js-libp2p-gossipsub that referenced this issue May 22, 2023
maschad added a commit to maschad/js-libp2p-gossipsub that referenced this issue May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants