com.netflix.loadbalancer
Class BestAvailableRule

java.lang.Object
  extended by com.netflix.loadbalancer.AbstractLoadBalancerRule
      extended by com.netflix.loadbalancer.ClientConfigEnabledRoundRobinRule
          extended by com.netflix.loadbalancer.BestAvailableRule
All Implemented Interfaces:
com.netflix.client.IClientConfigAware, IRule

public class BestAvailableRule
extends ClientConfigEnabledRoundRobinRule

A rule that skips servers with "tripped" circuit breaker and picks the server with lowest concurrent requests.

This rule should typically work with ServerListSubsetFilter which puts a limit on the servers that is visible to the rule. This ensure that it only needs to find the minimal concurrent requests among a small number of servers. Also, each client will get a random list of servers which avoids the problem that one server with the lowest concurrent requests is chosen by a large number of clients and immediately gets overwhelmed.


Constructor Summary
BestAvailableRule()
           
 
Method Summary
 Server choose(java.lang.Object key)
           
 void setLoadBalancer(ILoadBalancer lb)
           
 
Methods inherited from class com.netflix.loadbalancer.ClientConfigEnabledRoundRobinRule
initWithNiwsConfig
 
Methods inherited from class com.netflix.loadbalancer.AbstractLoadBalancerRule
getLoadBalancer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BestAvailableRule

public BestAvailableRule()
Method Detail

choose

public Server choose(java.lang.Object key)
Specified by:
choose in interface IRule
Overrides:
choose in class ClientConfigEnabledRoundRobinRule

setLoadBalancer

public void setLoadBalancer(ILoadBalancer lb)
Specified by:
setLoadBalancer in interface IRule
Overrides:
setLoadBalancer in class ClientConfigEnabledRoundRobinRule