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

brpc的wr/wrr负载均衡策略增加策略降级机制 #1570

Closed
Huixxi opened this issue Sep 28, 2021 · 2 comments
Closed

brpc的wr/wrr负载均衡策略增加策略降级机制 #1570

Huixxi opened this issue Sep 28, 2021 · 2 comments

Comments

@Huixxi
Copy link
Contributor

Huixxi commented Sep 28, 2021

Describe the bug (描述bug)
当前的wr/wrr负载均衡策略下,未配置权重的下游机器无法被添加到本次服务的机器列表当中,当用户忘记配置下游机器的权重时可能会因为机器列表为空无法选择一台下游机器而导致程序运行出错,提供策略降级机制可避免这种情况发生。

Describe the solution you'd like (描述你期望的解决方法)
通过给工作在这两种负载均衡机制下的未配置权重值的下游机器设置一个默认权重值1,从而这两种策略便自动降级至各自的非加权版本r/rr,并通过增加一个gflags:wlb_policy_degradation(默认关闭,false)来控制,当打开这个开关的时候(true)执行上述逻辑,默认条件下,则维持原有逻辑,即过滤未配置权重的下游机器。

@cdjingit
Copy link
Contributor

这样可否满足要求:给wr/wrr增加一个gflag表示默认的权重值,等于0表示未设置,保持现在的处理逻辑;大于0的情况,如果节点没有带权重值,就配置成改值,这样默认权重的大小由业务自己决定。

@Huixxi
Copy link
Contributor Author

Huixxi commented Sep 28, 2021

这样可否满足要求:给wr/wrr增加一个gflag表示默认的权重值,等于0表示未设置,保持现在的处理逻辑;大于0的情况,如果节点没有带权重值,就配置成改值,这样默认权重的大小由业务自己决定。

目前的内部解决方法是设置为1,然后wr和wrr在机器未配置权重的时候,降级为各自的r和rr负载均衡策略,已提交 #1571

@wwbmmm wwbmmm closed this as completed Aug 16, 2022
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

3 participants