brpc icon indicating copy to clipboard operation
brpc copied to clipboard

bthread_concurrency 支持减少 concurrency

Open wqshr12345 opened this issue 2 months ago • 1 comments

Is your feature request related to a problem? N/A

Describe the solution you'd like 希望 bthread_concurrency 可以支持减少 concurrency

Describe alternatives you've considered 我们使用 Bthread 实现了协程池,同时我们使用 Bthread Tag Group 来实现不同协程池之间底层 Worker 的分组。现在我们期望不同协程池的 Worker 数量可以动态调节,以灵活适应不同的场景。 但是我们翻阅代码发现,bthread_concurrency 和 bthread_concurrency_by_tag 两个均不支持减少 concurrency。 请问这里不支持减少 concurrency 是否存在什么考量?以及是否有好的建议帮助我们实现这样的功能呢?感谢!

Additional context/screenshots N/A

wqshr12345 avatar Oct 24 '25 03:10 wqshr12345

一般是性能跟不上了,去增加线程数量。减少线程的需求不是很多。而且内部实现,减少会把已有的很多已经初始化的worker相关东西都要析构掉,这块实现上比较复杂。

yanglimingcn avatar Oct 28 '25 09:10 yanglimingcn