-
Notifications
You must be signed in to change notification settings - Fork 26.5k
New issue
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
LeastActiveLoadBalance负载均衡 #904
Comments
Hi, could you please send a pull request? |
If the offsetWeight doesn't decrease lower than 0 after loop, it maybe mean that all the least active invokers are in warmup, then the LeastActiveLoadBalance will select a random one from these same active invokers. How about make it like this:
But this way will cause more loops, which will make the select process more time consuming. And or!
|
Change the line |
@wannshan |
may be taotalWeightWithWarmUp will be better ,after all not after but warming.... |
That make sense. |
Hi, I submit a new issue here: |
74行 int offsetWeight = random.nextInt(totalWeight);//这里totalWeight是没有经过warmup降权的值的和
78 offsetWeight -= getWeight(invokers.get(leastIndex), invocation);//这个是经过warmup降权的。
当服务刚启动,经过warmup降权后的getWeight返回的值,可能经过leastCount次循环后,还是offsetWeight >0
造成选不到invoker
for (int i = 0; i < leastCount; i++) {
int leastIndex = leastIndexs[i];
offsetWeight -= getWeight(invokers.get(leastIndex), invocation);
if (offsetWeight <= 0)
return invokers.get(leastIndex);
}
The text was updated successfully, but these errors were encountered: