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 Connection Management #37

Open
7 tasks
dariusc93 opened this issue Mar 2, 2023 · 2 comments
Open
7 tasks

Implement Connection Management #37

dariusc93 opened this issue Mar 2, 2023 · 2 comments
Labels
p:low Low Priority question Further information is requested

Comments

@dariusc93
Copy link
Owner

dariusc93 commented Mar 2, 2023

Currently, connection management is mostly connection limits, which is currently implemented into PeerBook using NetworkBehaviour (based on libp2p/rust-libp2p#3386). This behaviour does support whitelisting peers (which is more of an "allow list") to bypass the limits, but this is basic (and would likely be in a separate behaviour)

Down the road, we would need a realistic connection manager that would close least useful connections upon reaching a specific limit set. This would close connections to peers that are not guarded or protected by a protocol or behaviour such gossipsub, kad, or even in cases like PeerBook, though may need to check to determine the best course on checking the peer in other behaviours outside of what we managed (eg if the peer is actively subscribed to a topic in gossip, or apart of routing in kad, used for a relay, exchanging data via bitswap, etc). A scoring system would likely need to be implemented in some way.

TODO:

  • Protect peers manually added to PeerBook
    • This is done already, but the peer should not be counted towards the connection limit, while the current implementation, it does count.
  • Make sure tagged peers dont count towards the connection limit
  • Tag peers used in specific protocols
    • Peers subscribed to the same topic in gossipsub, untagging when unsubscribed
    • Peers exchanging blocks with bitswap, untagging when exchanging of blocks are done or have timed out.
    • Peers used as a relay.
  • Automatically remove tagged peers that disconnected (though protected peers will remain in place)
@dariusc93 dariusc93 added question Further information is requested p:high High Priority labels Mar 2, 2023
@dariusc93
Copy link
Owner Author

Note: Instead of this being maintained in PeerBook, this will be pushed into its own behaviour (which will likely include the connection limits being moved into said behaviour) to keep things more consistent within the scope of the behaviour purpose.

@dariusc93 dariusc93 added p:low Low Priority and removed p:high High Priority labels Nov 14, 2023
@dariusc93
Copy link
Owner Author

Connection management itself may be pushed to be handled a bit more in libp2p, although there will still be tracking and cleanup of connections later on here if we reach a threshold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:low Low Priority question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant