We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当采用failover重试机制(默认)且只有两个Invoker(Provider)时,不论配置了什么负载均衡loadbalance策略,都会退化成轮询策略。但是retry重试时选择Invoker的逻辑有问题,源码在AbstractClusterInvoker.java的doSelect()方法中: if (invokers.size() == 2 && selected != null && !selected.isEmpty()) { return selected.get(0) == invokers.get(0) ? invokers.get(1) : invokers.get(0); } 假设有两个可选invoke,分别为: 10.0.0.1:20884,10.0.0.1:20886; 那么N次选择的invoke如下: 10.0.0.1:20884 10.0.0.1:20886 10.0.0.1:20886 10.0.0.1:20886 10.0.0.1:20886 ... ... 即除了第1次,其他N-1次都是选择第二个Invoker。
修改建议: 将 return selected.get(0) == invokers.get(0) ? 改为 return selected.get(selected.size()-1) == invokers.get(0) ? 即每次重新选择时与前一次选择的Invoker比较,而不是与第一次选择的Invoker比较;
The text was updated successfully, but these errors were encountered:
经过测试,确实是有这个问题
Sorry, something went wrong.
@ralf0131 Fixed, able to close.
@carryxyh Thanks, I checked the latest code, I has been fixed by #1759
: ) u are welcome
No branches or pull requests
当采用failover重试机制(默认)且只有两个Invoker(Provider)时,不论配置了什么负载均衡loadbalance策略,都会退化成轮询策略。但是retry重试时选择Invoker的逻辑有问题,源码在AbstractClusterInvoker.java的doSelect()方法中:
if (invokers.size() == 2 && selected != null && !selected.isEmpty()) {
return selected.get(0) == invokers.get(0) ? invokers.get(1) : invokers.get(0);
}
假设有两个可选invoke,分别为:
10.0.0.1:20884,10.0.0.1:20886;
那么N次选择的invoke如下:
10.0.0.1:20884
10.0.0.1:20886
10.0.0.1:20886
10.0.0.1:20886
10.0.0.1:20886
... ...
即除了第1次,其他N-1次都是选择第二个Invoker。
修改建议:
将
return selected.get(0) == invokers.get(0) ?
改为
return selected.get(selected.size()-1) == invokers.get(0) ?
即每次重新选择时与前一次选择的Invoker比较,而不是与第一次选择的Invoker比较;
The text was updated successfully, but these errors were encountered: