public class FairStrategy extends Object implements LoadBalanceStrategy
Algorithm overview: The fair load balancing policy dynamically adjusts the weight of each server and divides it by weight. Rpc client maintains a latency window record rpc time for each server, after processing a traffic, the server updates its own window. If the mean value of the service in the window > the overall mean of the service, reduce its own weight. On the contrary, increase its own weight. When the window is not full, the polling does not adjust the weight.
| 构造器和说明 |
|---|
FairStrategy() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
destroy() |
void |
init(RpcClient rpcClient) |
void |
markInvalidInstance(List<BrpcChannelGroup> instances)
Since the weight tree will update by a period of time, so if there's any invalid instance,
the business should notify the fair strategy.
|
BrpcChannelGroup |
selectInstance(CopyOnWriteArrayList<BrpcChannelGroup> instances) |
public void init(RpcClient rpcClient)
init 在接口中 LoadBalanceStrategypublic BrpcChannelGroup selectInstance(CopyOnWriteArrayList<BrpcChannelGroup> instances)
selectInstance 在接口中 LoadBalanceStrategypublic void destroy()
destroy 在接口中 LoadBalanceStrategypublic void markInvalidInstance(List<BrpcChannelGroup> instances)
Copyright © 2018 Baidu, Inc.. All rights reserved.