Package io.deephaven.util
Class LoadBalancerUtil
java.lang.Object
io.deephaven.util.LoadBalancerUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]
rearrangeHosts
(String[] hosts) If localhost is in the list of hosts, put it first, and shuffle the rest of list.static String[]
rearrangeUrls
(String[] urls) Similar to rearrangeHosts but with URLs.static String[]
shuffleArrayToNew
(String[] src) static void
shuffleSubarrayInPlace
(String[] ss, int firstPos, int lastPos) static String
simpleUrlToHost
(String url) static String[]
swapToFirstPositionAndShuffleRest
(String[] src, int swapPos)
-
Constructor Details
-
LoadBalancerUtil
public LoadBalancerUtil()
-
-
Method Details
-
rearrangeUrls
Similar to rearrangeHosts but with URLs. -
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
-
simpleUrlToHost
-