-
Notifications
You must be signed in to change notification settings - Fork 2.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
iwrr: a wrr with always O(1) time and O(n) memory #1729
Conversation
0e04a49
to
3f49543
Compare
Hello, @chobits and @wangfakang . PLAT thanks :) |
abandons smoothness? Can you give a specific example of this shortcoming? |
Hello, @lhanjian . There is no clear proof that the smoothness and stability of load balancing are positively correlated in large traffic scenarios. In my opinion, in a large traffic scenario, no matter what algorithm, a complete load balancing cycle will be completed quickly, as long as the load balancing does not continuously select the same instance (eg, A:1, B:1 appear continuously likes AAAAABBBBB in 10 selections). iwrr ensures that duplicate instances are avoided as much as possible within a continuous time window. For example, for the instance list A:1, B:2, C:3, D:4, E:5, then the sequence selected by iwrr is ABCDEBCDECDEDEE, but not ABBCCCDDDDEEEEE. So I think this may not be a shortcoming, just a little difference from swrr. |
d4f7beb
to
000a79b
Compare
Hello, @chobits . All issues are fixed, PTAL |
LGTM |
An IWRR implementation likes lua-resty-balancer, but uses the double queue as same as the O(1) scheduler to avoid many rounds of pointless traversals to ensure always be O(1).
IWRR abandons smoothness on the premise of ensuring the correctness of the weighted load balancing algorithm. The memory overhead is only a queue with two sentinels, no matter how big the total weight is, only n + 2 elements of memory space will be allocated in the process, is more suitable for very large size clusters with different weights.