-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: generic many to many connection ability for NodeConnectionManager
#483
Comments
The first step would be updating the After that we need to have logic for attempting connections to a list of Ip addresses resolved from the hostnames. I'll build in a concurrency limiting logic using a Semaphore. I think we'll default to full concurrency, but it would be useful to limit that. |
The It would need to try each one and whichever one succeeds is the correct one. However some of the checks done can be done independently, so only loop over the checks that involve the |
How do we handle multi-node connecting without screwing up how the So with that, we should use the I don't think this needs to be a method of the |
As talked about yesterday, this multinode resolver should be something like:
The creation of a If we want to use it as part of For locking... I'm not sure yet, maybe some of the locks needs to be broken down. |
I'm not sure about making it a method of |
The
The The multiple
The last transformation could happen 2 ways. The first way is that you attempt to connect to each NodeId iteratively or in parallel. But this translates to trying each IP/Host one at at time, until the
This can result in wasted connection establishments. Like connecting to IP1 here could be wasted, if NodeIdB is actually the representative NodeId for IP1. The second strategy is to group all the IP addresses (uniquely), and try all of the IP addresses, classifying them by the However, if the NodeIds can be connected via multiple potential IPs, then you could be wasting connections, if you've already made a connection to that NodeId already. Currently this would be unlikely, until we have MatrixAI/js-mdns#1 where private IPs take precedence over public IPs. |
I think in this instance, strategy 2 will be more efficient because it's unlikely for our NodeIds to each have multiple accessible IPs. It's more likely that we just don't know which IP correlates to which NodeId. With respect to locking, the proxy locks per remote address, while the node connection manager locks per node ID. These locking concepts still make sense. It's just that at the node connection manager, the locks must be generalised to multilocking, while also changing to |
Changing the reference count will address the expiry TTLs as well. One example is:
|
One concern with the multi-node connection. We still have to find the node before we connect to it at that is still a fundamentally a single I may have to update the But if we're only doing multi-connections to the seed nodes then we don't actually do any finding using kademlia. We should already have the required connection information.
|
The This makes strategy 2 infeasible, because it would only work if establishing connections occurred after finding addresses. Ideally So any multi-node connection system will end up doubling up on connection establishment work. We can optimise this later by first collapsing node connections with proxy connections when we upgrade the network system. Then subsequently change the way we are finding nodes and connecting to them to be more generic and parallelised. This can make use of async generators connect a source of candidate node addresses to candidate hosts to realised node connections. That means at the moment, we will just continue using |
Specification
The
NodeConnectionManager
needs a new method to establish multiple connections at once given a set ofNodeId
and addresses. This will be similar towithConnF
andwithConnG
but it can take an array of desiredNodeids
and a second array of addresses. It will then attempt to establish connections with the set of addresses and find any node in the provided set of nodes.This would enable us to do generic network entry were we can specify a single DNS hostname that resolves to all of our seed nodes. Then we can connect to one or more of them at the same time using this method.
We will also need some options for this. In some situations we can want all possible connects, any of them, the first 3 connections or just the first connection made.
This would depend on the ability to resolve a hostname to multiple 'A' or 'AAAA' records.
Additional context
testnet.polykey.com
Polykey-CLI#71hostname
to multiple addresses when connecting to a node #484Tasks
NodeConnectionManager
to generically establish one or more connections when looking for one or more nodes.The text was updated successfully, but these errors were encountered: