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

Optimise NodeConnectionManager.getClosestGlobalNodes to concurrently contact nodes #448

Closed
2 tasks
tegefaulkes opened this issue Sep 21, 2022 · 3 comments
Closed
2 tasks
Assignees
Labels
development Standard development r&d:polykey:core activity 4 End to End Networking behind Consumer NAT Devices

Comments

@tegefaulkes
Copy link
Contributor

Specification

getClosestGlobalNodes is the core logic for finding a node within the Kademlia network. Currently is implemented as a priority queue that queries a node for a list of nodes close to the target node. it then sequetially pings each node to see if it's alive before adding it to the NodeGraph.

This needs to be optimised to ping K nodes concurrently. It also needs to only ping and contact nodes in the priority order.

Additional context

Tasks

  • 1. Nodes need to be pinged concurrently to check if they're alive. We can use the Semaphore from @matrixai/async-locks to enforce the concurrency limit.
  • 2. Only ping a node just before trying to connect to it. There is no need to ping every node since we only need to connect in the priority order.
@tegefaulkes tegefaulkes added the development Standard development label Sep 21, 2022
@tegefaulkes tegefaulkes self-assigned this Sep 21, 2022
@CMCDragonkai CMCDragonkai added the r&d:polykey:core activity 3 Peer to Peer Federated Hierarchy label Jul 10, 2023
@tegefaulkes
Copy link
Contributor Author

This issue is not relevant anymore. The findNode procedure was completely revamped in #618 .

@CMCDragonkai
Copy link
Member

So it is not sequential anymore?

@tegefaulkes
Copy link
Contributor Author

Yep, up to 3-6* connections are made concurrently during the nodesFind operation depending on how it's configured. Nodes are added to the NodeGraph when the NodeManager handles the connection event.

@CMCDragonkai CMCDragonkai added r&d:polykey:core activity 4 End to End Networking behind Consumer NAT Devices and removed r&d:polykey:core activity 3 Peer to Peer Federated Hierarchy labels Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development r&d:polykey:core activity 4 End to End Networking behind Consumer NAT Devices
Development

No branches or pull requests

2 participants