The current implementation of picking nodes requires sorting an array of nodes first which can be very slow and requires a lock for each request. Replacing it with a randomly picking a node will achieve much higher performance.
Solution
Break nodes into two lists one for healthy nodes and one for unhealthy nodes.
Remove all use of sorting from the networks
Update ManagedNetwork.getNumberOfHealthyNodes() to use Math.random()
Update Network.getNode()
to use Math.random()
to move nodes from the unhealthy collection into healthy collection which have surpassed their backoff
Update Executable.execute() to move the node to the unhealthy nodes collection whenever a bad gRPC status is hit (this should sort the unhealthy collection)
Problem
The current implementation of picking nodes requires sorting an array of nodes first which can be very slow and requires a lock for each request. Replacing it with a randomly picking a node will achieve much higher performance.
Solution
nodes
into two lists one for healthy nodes and one for unhealthy nodes.ManagedNetwork.getNumberOfHealthyNodes()
to useMath.random()
Network.getNode()
Math.random()
Executable.execute()
to move the node to the unhealthy nodes collection whenever a bad gRPC status is hit (this should sort the unhealthy collection)Alternatives
No response