Class LoadBalancingPolicies

java.lang.Object
io.servicetalk.loadbalancer.LoadBalancingPolicies

public final class LoadBalancingPolicies extends Object
A factory to create different LoadBalancingPolicy variants.
  • Method Details

    • roundRobin

      public static RoundRobinLoadBalancingPolicyBuilder roundRobin()
      Builder for the round-robin LoadBalancingPolicy.

      Round-robin load balancing is a strategy that maximizes fairness of the request distribution. This comes at the cost of being unable to bias toward better performing hosts and can only leverage the course grained healthy/unhealthy status of a host.

      Returns:
      a builder for the round-robin LoadBalancingPolicy.
    • p2c

      public static P2CLoadBalancingPolicyBuilder p2c()
      Builder for the power of two choices (P2C) LoadBalancingPolicy.

      Power of Two Choices (P2C) leverages both course grained healthy/unhealthy status of a host plus additional fine-grained scoring to prioritize hosts that are both healthy and better performing. See the P2CLoadBalancingPolicy for more details.

      Returns:
      a builder for the power of two choices (P2C) LoadBalancingPolicy.