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

redistributor实现困惑的地方 #1

Open
schecterdamien opened this issue Jan 27, 2021 · 0 comments
Open

redistributor实现困惑的地方 #1

schecterdamien opened this issue Jan 27, 2021 · 0 comments

Comments

@schecterdamien
Copy link

atomic.StoreUint64(&pr.upperThreshold, uint64(average*pr.loadFactor))

这里有问题吧,我理解bucket的装载因子应该表示桶的理想满载率,这里用当前paris总数 / bucket数得到每个桶的平均pairs,应该除以load factor得到一个上限,而不是乘吧。举个例子,如果每个桶都完全均衡了,那每个桶的size都是平均pairs,再乘0.75肯定比平均值小,按照这里的写法,每个bucket check都会发现OVERWEIGHT了,然后要redistribution,但是实际上已经完全均衡了吗,书上也这么写的。还有个疑问,这里缺少UNDERWEIGHT状态的赋值,但是下面有UNDERWEIGHT的判断,也让人困惑。

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

1 participant