|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.loadbalancer.AbstractLoadBalancerRule
com.netflix.loadbalancer.RoundRobinRule
com.netflix.loadbalancer.ResponseTimeWeightedRule
WeightedResponseTimeRule
public class ResponseTimeWeightedRule
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.
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 |
|---|
public static final com.netflix.client.config.IClientConfigKey<java.lang.Integer> WEIGHT_TASK_TIMER_INTERVAL_CONFIG_KEY
public static final int DEFAULT_TIMER_INTERVAL
protected java.util.Timer serverWeightTimer
protected java.util.concurrent.atomic.AtomicBoolean serverWeightAssignmentInProgress
| Constructor Detail |
|---|
public ResponseTimeWeightedRule()
public ResponseTimeWeightedRule(ILoadBalancer lb)
| Method Detail |
|---|
public void setLoadBalancer(ILoadBalancer lb)
setLoadBalancer in interface IRulesetLoadBalancer in class AbstractLoadBalancerRulepublic void shutdown()
public Server choose(ILoadBalancer lb,
java.lang.Object key)
choose in class RoundRobinRulepublic void initWithNiwsConfig(com.netflix.client.config.IClientConfig clientConfig)
initWithNiwsConfig in interface com.netflix.client.IClientConfigAwareinitWithNiwsConfig in class RoundRobinRule
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||