WeightedResponseTimeRule
如何在功能区中工作?
WeightedResponseTimeRule
使用平均/百分响应时间为每个服务器分配动态“权重”的规则,然后在“加权循环”中使用该规则。
但是,我不了解它calculates the *weights* per Server which is then used in the "Weighted Round Robin" fashion
这是AbstractLoadBalancerAwareClient
的源代码,并且没有任何跟踪标记已更新所使用服务器的weights
:
```java
public T executeWithLoadBalancer(final S request, final IClientConfig requestConfig) throws ClientException {
LoadBalancerCommand<T> command = buildLoadBalancerCommand(request, requestConfig);
try {
return command.submit(
new ServerOperation<T>() {
@Override
public Observable<T> call(Server server) {
URI finalUri = reconstructURIWithServer(server, request.getUri());
S requestForServer = (S) request.replaceUri(finalUri);
try {
return Observable.just(AbstractLoadBalancerAwareClient.this.execute(requestForServer, requestConfig));
}
catch (Exception e) {
return Observable.error(e);
}
}
})
.toBlocking()
.single();
} catch (Exception e) {
Throwable t = e.getCause();
if (t instanceof ClientException) {
throw (ClientException) t;
} else {
throw new ClientException(e);
}
}
}
```
谢谢