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

Tagged task group设置不同tag的task数量 #2581

Closed
lhsoft opened this issue Mar 26, 2024 · 8 comments
Closed

Tagged task group设置不同tag的task数量 #2581

lhsoft opened this issue Mar 26, 2024 · 8 comments

Comments

@lhsoft
Copy link
Contributor

lhsoft commented Mar 26, 2024

当前每个tagged task group数量是平均分配,但现实中需要对不同的task group指定不同的worker数量

可以增加一个FLAGS_per_tagged_task_group_numbers = "20:40:40",指定不同task group的数量

@yanglimingcn
Copy link
Contributor

现在有两个参数可以配置
1、bthread_current_tag 用于指定 tag
2、bthread_concurrency_by_tag 用户设置(1)中tag的worker数量

@lhsoft
Copy link
Contributor Author

lhsoft commented Mar 26, 2024

现在有两个参数可以配置 1、bthread_current_tag 用于指定 tag 2、bthread_concurrency_by_tag 用户设置(1)中tag的worker数量

我看了下代码,这两个参数只能动态添加,且不能超过bthread_concurrency的上限,我的需求是:初始化的时候,设置bthread_currency, 同时指定不同的tag对应的worker number,看起来这两个参数不能完全满足

@lhsoft lhsoft changed the title Tagged task group增加不同tag的task数量 Tagged task group设置不同tag的task数量 Mar 26, 2024
@yanglimingcn
Copy link
Contributor

感觉你可以把bthread_min_concurrency设置成非0的,然后bthread_concurrency设置成一个比较大的数。
然后再用上边的方式调整每组worker,你看看行不行。
多组的配置这块我其实也没想好怎么搞合理。

@yanglimingcn
Copy link
Contributor

当前每个tagged task group数量是平均分配,但现实中需要对不同的task group指定不同的worker数量

可以增加一个FLAGS_per_tagged_task_group_numbers = "20:40:40",指定不同task group的数量

@wwbmmm 你有啥好的建议吗?你觉得这么搞可以吗?

@wwbmmm
Copy link
Contributor

wwbmmm commented Apr 1, 2024

当前每个tagged task group数量是平均分配,但现实中需要对不同的task group指定不同的worker数量
可以增加一个FLAGS_per_tagged_task_group_numbers = "20:40:40",指定不同task group的数量

@wwbmmm 你有啥好的建议吗?你觉得这么搞可以吗?

感觉多组的tag配置还是动态设置比较好,gflag本身不适合用来表达过于复杂的逻辑。如果用户需要在启动时指定,可以定义自己的gflag配置,然后根据自己的gflag配置调用bthread的接口来设置每一组的worker数量。

@lhsoft
Copy link
Contributor Author

lhsoft commented Apr 1, 2024

多谢二位,动态配置确实可以实现目的,但感觉还是不够方便。最好有一种更只管简单的方式,大家线上用tagged group,也很少使用平均分配的方式吧。

@yanglimingcn
Copy link
Contributor

我理解bRPC框架支持这个能力,策略由业务层调用这些能力就能达到。比如:你自己设置一个gflags变量FLAGS_per_tagged_task_group_numbers = "20:40:40",在validator里面
调用bthread_set_minconcurrency bthread_setconcurrency bthread_current_tag bthread_concurrency_by_tag 这些函数,在初始化阶段就把不同池子的worker的数量设置好了。

@yanglimingcn
Copy link
Contributor

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