-
Notifications
You must be signed in to change notification settings - Fork 886
feat(loadbalance): add loadbalancer using Alias Method to reduce the time complexity of weighted random load balancing algorithms #1199
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1199 +/- ##
===========================================
+ Coverage 66.89% 66.97% +0.07%
===========================================
Files 256 257 +1
Lines 19479 19534 +55
===========================================
+ Hits 13031 13082 +51
- Misses 5271 5282 +11
+ Partials 1177 1170 -7 ☔ View full report in Codecov by Sentry. |
thanks for the contribution. Please fix the ci issue and add the reference of this algorithm in the pr description |
Can we add a benchmark for init, which is also used when rebalance. |
|
LGTM |
我觉得这个 PR 已经可以和进去了(但是貌似会报一些我感觉奇怪的 CI 问题 |
什么问题? |
review 通过一下看看👀 |
kitex/pkg/loadbalance/weighted_balancer_test.go at 834c15a5e6c7def209f257246122803ed1e77b92 · cloudw 发现这个 BenchmarkWeightedPicker_Next 测试结果有点奇怪:“weitghted_random” 的性能并没有随着n增大而裂化(明明是O(N)),导致新算法的收益看起来不是很明显。初步debug看了下传到weightedRandomPicker.Next()里面的instances一直都是10估计是有bug,cc @ppzqh 。 同学如果有兴趣也帮忙看看问题在哪吧 @NX-Official |
这个单测问题我修了,辛苦rebase一下,再跑个测试 |
834c15a
to
037d37e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@NX-Official Hi, 这个alis method的功能要辛苦你帮忙补充一个介绍文档。可以参考官网文档进行添加,包括中英文两个文件。感谢你的支持! |
What type of PR is this?
Check the PR title.
(Optional) Translate the PR title into Chinese.
添加一种使用 Alias Method 的负载均衡方法,来减少权重随机负载均衡算法的时间复杂度
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
Alias Method:
https://en.wikipedia.org/wiki/Alias_method
http://www.keithschwarz.com/darts-dice-coins/
zh(optional):
https://nickxu.me/post/darts-dice-coins-chinese-version
(Optional) Which issue(s) this PR fixes:
#1184
(optional) The PR that updates user documentation: