Package io.servicetalk.loadbalancer
Class P2CLoadBalancingPolicy<ResolvedAddress,C extends LoadBalancedConnection>
java.lang.Object
io.servicetalk.loadbalancer.LoadBalancingPolicy<ResolvedAddress,C>
io.servicetalk.loadbalancer.P2CLoadBalancingPolicy<ResolvedAddress,C>
- Type Parameters:
ResolvedAddress
- the type of the resolved address.C
- the type of the load balanced connection.
public final class P2CLoadBalancingPolicy<ResolvedAddress,C extends LoadBalancedConnection>
extends LoadBalancingPolicy<ResolvedAddress,C>
A random selection "power of two choices" load balancing policy.
This LoadBalancer
selection algorithm is based on work by Michael David Mitzenmacher in The Power of Two
Choices in Randomized Load Balancing.
This load balancing policy is characterized by the algorithm: - select two hosts randomly: hosta, and hostb. - if neither host is healthy, repeat selection process until max-effort. - pick the 'best' host of the two options.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A builder for immutableP2CLoadBalancingPolicy
instances. -
Method Summary
-
Method Details
-
name
Description copied from class:LoadBalancingPolicy
The name of the load balancing policy.- Specified by:
name
in classLoadBalancingPolicy<ResolvedAddress,
C extends LoadBalancedConnection> - Returns:
- the name of the load balancing policy
-
toString
- Specified by:
toString
in classLoadBalancingPolicy<ResolvedAddress,
C extends LoadBalancedConnection>
-