com.netflix.loadbalancer
Class ResponseTimeWeightedRule

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

Deprecated. Use WeightedResponseTimeRule

public class ResponseTimeWeightedRule
extends RoundRobinRule

Rule that use the average/percentile response times to assign dynamic "weights" per Server which is then used in the "Weighted Round Robin" fashion.

The basic idea for weighted round robin has been obtained from JCS The implementation for choosing the endpoint from the list of endpoints is as follows:Let's assume 4 endpoints:A(wt=10), B(wt=30), C(wt=40), D(wt=20).

Using the Random API, generate a random number between 1 and10+30+40+20. Let's assume that the above list is randomized. Based on the weights, we have intervals as follows:

1-----10 (A's weight)
11----40 (A's weight + B's weight)
41----80 (A's weight + B's weight + C's weight)
81----100(A's weight + B's weight + C's weight + C's weight)

Here's the psuedo code for deciding where to send the request:

if (random_number between 1 & 10) {send request to A;}
else if (random_number between 11 & 40) {send request to B;}
else if (random_number between 41 & 80) {send request to C;}
else if (random_number between 81 & 100) {send request to D;}

When there is not enough statistics gathered for the servers, this rule will fall back to use RoundRobinRule.

See Also:
WeightedResponseTimeRule

Field Summary
static int DEFAULT_TIMER_INTERVAL
          Deprecated.  
protected  java.util.concurrent.atomic.AtomicBoolean serverWeightAssignmentInProgress
          Deprecated.  
protected  java.util.Timer serverWeightTimer
          Deprecated.  
static com.netflix.client.config.IClientConfigKey<java.lang.Integer> WEIGHT_TASK_TIMER_INTERVAL_CONFIG_KEY
          Deprecated.  
 
Constructor Summary
ResponseTimeWeightedRule()
          Deprecated.  
ResponseTimeWeightedRule(ILoadBalancer lb)
          Deprecated.  
 
Method Summary
 Server choose(ILoadBalancer lb, java.lang.Object key)
          Deprecated.  
 void initWithNiwsConfig(com.netflix.client.config.IClientConfig clientConfig)
          Deprecated.  
 void setLoadBalancer(ILoadBalancer lb)
          Deprecated.  
 void shutdown()
          Deprecated.  
 
Methods inherited from class com.netflix.loadbalancer.RoundRobinRule
choose
 
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
 

Field Detail

WEIGHT_TASK_TIMER_INTERVAL_CONFIG_KEY

public static final com.netflix.client.config.IClientConfigKey<java.lang.Integer> WEIGHT_TASK_TIMER_INTERVAL_CONFIG_KEY
Deprecated. 

DEFAULT_TIMER_INTERVAL

public static final int DEFAULT_TIMER_INTERVAL
Deprecated. 
See Also:
Constant Field Values

serverWeightTimer

protected java.util.Timer serverWeightTimer
Deprecated. 

serverWeightAssignmentInProgress

protected java.util.concurrent.atomic.AtomicBoolean serverWeightAssignmentInProgress
Deprecated. 
Constructor Detail

ResponseTimeWeightedRule

public ResponseTimeWeightedRule()
Deprecated. 

ResponseTimeWeightedRule

public ResponseTimeWeightedRule(ILoadBalancer lb)
Deprecated. 
Method Detail

setLoadBalancer

public void setLoadBalancer(ILoadBalancer lb)
Deprecated. 
Specified by:
setLoadBalancer in interface IRule
Overrides:
setLoadBalancer in class AbstractLoadBalancerRule

shutdown

public void shutdown()
Deprecated. 

choose

public Server choose(ILoadBalancer lb,
                     java.lang.Object key)
Deprecated. 
Overrides:
choose in class RoundRobinRule

initWithNiwsConfig

public void initWithNiwsConfig(com.netflix.client.config.IClientConfig clientConfig)
Deprecated. 
Specified by:
initWithNiwsConfig in interface com.netflix.client.IClientConfigAware
Overrides:
initWithNiwsConfig in class RoundRobinRule