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

加权的负载均衡策略 #19

Open
firebook opened this issue Nov 17, 2020 · 1 comment
Open

加权的负载均衡策略 #19

firebook opened this issue Nov 17, 2020 · 1 comment

Comments

@firebook
Copy link

firebook commented Nov 17, 2020

`
size_t size = service_list.size();

int begin_index = rand() % size;
int rand_index = begin_index;
do {
ret = mnsc_thrift_client->CreateThriftClient(service_list[rand_index].ip,
service_list[rand_index].port,
timeout_);
if (SUCCESS == ret) {
return SUCCESS;
}
rand_index = (rand_index + 1) % size;
} while(rand_index != begin_index);
`
有点疑惑请教下:
这一部分是实现负载均衡策略的吗?一个随机策略?没有加权吗?
但是看portal截图是可以配置服务器权重的,是另外的地方实现了加权负载均衡策略吗?

@tiancihui
Copy link
Member

可以发下上下文么?哪个文件,多少行之类的?

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