Class LoadBalancerUtil

java.lang.Object
io.deephaven.util.LoadBalancerUtil

public class LoadBalancerUtil extends Object
  • Constructor Details

    • LoadBalancerUtil

      public LoadBalancerUtil()
  • Method Details

    • rearrangeUrls

      public static String[] rearrangeUrls(String[] urls)
      Similar to rearrangeHosts but with URLs.
    • rearrangeHosts

      public static String[] rearrangeHosts(String[] hosts)
      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

      public static String[] swapToFirstPositionAndShuffleRest(String[] src, int swapPos)
    • shuffleArrayToNew

      public static String[] shuffleArrayToNew(String[] src)
    • shuffleSubarrayInPlace

      public static void shuffleSubarrayInPlace(String[] ss, int firstPos, int lastPos)
    • simpleUrlToHost

      public static String simpleUrlToHost(String url)