Skip to content

LeastActiveLoadBalance负载均衡 #904

@wannshan

Description

@wannshan

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedEverything needs help from contributors

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions