Package io.deephaven.util
Class LoadBalancerUtil
java.lang.Object
io.deephaven.util.LoadBalancerUtil
public class LoadBalancerUtil extends Object
-
Constructor Summary
Constructors Constructor Description LoadBalancerUtil()
-
Method Summary
Modifier and Type Method Description static String[]
rearrangeHosts(String[] hosts)
If localhost is in the list of hosts, put it first, and shuffle the rest of list.static String[]
shuffleArrayToNew(String[] src)
static void
shuffleSubarrayInPlace(String[] ss, int firstPos, int lastPos)
static String[]
swapToFirstPositionAndShuffleRest(String[] src, int swapPos)
-
Constructor Details
-
LoadBalancerUtil
public LoadBalancerUtil()
-
-
Method Details
-
rearrangeHosts
If localhost is in the list of hosts, put it first, and shuffle the rest of list. Otherwise, shuffle the whole list. This should provide an efficient approach for host selection under gRPC's "pick_first" load balancing strategy. The expected effect is: (1) On startup, when there is an auth server in our same host, we talk to that. (2) On failover, when there is more than 2 auth server totals, we avoid all clients from the failing auth server flocking to the same alternative. -
swapToFirstPositionAndShuffleRest
-
shuffleArrayToNew
-
shuffleSubarrayInPlace
-