Support multiple algorithms for choosing a list of nodes #599
Replies: 3 comments 1 reply
-
Calling it Performance will definitely cause growth issues down the line. Something like Random or RNG is probably better. It might also be possible to implement a single nn algorithm to eval nodes on specific criteria. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
For the current |
Beta Was this translation helpful? Give feedback.
-
Current behavior:
To execute a request a list of nodes account IDs must be set on the request. This list of nodes could set by the user or a list of nodes will be picked for the user from the client's network. Whenever the network picks the nodes for the request it will order the current list of nodes based on the node's "health" which is determined by when it was used last and the amount of times the node has been used. In both Java and Go the Network must be thread safe since the user has an option to make concurrent requests. To acheive thread safety the network has lock it uses whenever it sorts the list of nodes. Although the current behavior works fine for 99% of test cases, it's a huge issue for performance. Users should have the option to use different algorithms which are more performant.
Notes:
Client.pingAll()
being implemented the network now not only sorts the list of nodes, but also removes nodes which have surpassed max attempts.Desired behavior:
When constructing the
Client
the user could use some methodClient.setNetworkNodeChoosingAlgorithm()
to set which algorithm they'd like to use.Proposed Algorithms:
- Performance: Use a random number generator to pick a list a nodes
- RoundRobin (default): Current implementation
- None: Require a user to set the list of nodes for each request themselves
Note:
Performance
as algorithm name might not be the best idea since we might eventually implement some other algorithm which has better performance than the currentPerformance
algorithm. At that point would we simply change whatPerformance
does, or would we add another algorithm option to allow users to pick between the older performance algorithm and the new one?Beta Was this translation helpful? Give feedback.
All reactions