Skip to content
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

A little WeightedResponseTimeRule bug #375

Open
shunminli opened this issue May 2, 2018 · 2 comments
Open

A little WeightedResponseTimeRule bug #375

shunminli opened this issue May 2, 2018 · 2 comments

Comments

@shunminli
Copy link

shunminli commented May 2, 2018

image

as shown above, the d >= randomWeight should be d > randomWeight
It is going to cause a probability error.
if totalWeight == X+Y+Z , weights = [X, X+Y, X+Y+Z]

d >= randomWeight split ranges like [0, X], (X, X+Y], (X+Y, X+Y+Z)
d > randomWeight split ranges like [0, X), [X, X+Y),[X+Y, X+Y+Z)

as we know, the randomWeight is a random number in [0, X+Y+Z)

it means when d >= randomWeight first range's probability will be large than the weight/totalWeight
and last range's probability will be less than the weight/totalWeight

so the correct is d > randomWeight

the fix commit #376

shunminli added a commit to shunminli/ribbon that referenced this issue May 2, 2018
@mujun0312
Copy link

我认为每个权重区间边界的开闭形式是这样子的:(x, y],与此同时,因为随机值randomWeight的最小值可以为0,最大值取不到最大的权重值,因此,第一个服务实例的权重区间的下限是闭区间,最后一个实例的权重区间的上限是开区间,所以我认为判断条件:d >= randomWeight 是正确的。

@shunminli
Copy link
Author

shunminli commented Dec 26, 2018

randomWeight 是 0 没问题啊 > 的话 也是 [0, X)
假设三个 weight 分别是 2, 2, 2 那么
d 依次是 2, 4, 6
我们已知 randomWeight 的分布在 [0, 6)

如果是 d >= randomWeight 你将会得到三个概率区间 [0, 2],(2, 4],(4, 6)
如果是 d > randomWeight 你将会得到 [0, 2),[2, 4),[4, 6)
你认为哪个是正确的呢?
问题不在于 第一个服务实例的下限和最后一个服务的上限,问题出在第一个服务的上限和最后一个服务的下限 @mujun0312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants