vinllen opened a new issue, #2374:
URL: https://github.com/apache/brpc/issues/2374

   **Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)**
   bthread这种模型更适合网络IO比较重的场景,对于某些场景比如磁盘IO比较重的话,会导致bthread 
worker线程TaskGroup长期被占用,导致别的任务得不到调度。
   
   **Describe the solution you'd like (描述你期望的解决方法)**
   
bthread支持多个线程池,比如线程池1处理brpc/braft消息的分发,线程池2用于用户业务内部代码的运转。这样也方便做隔离,防止因为业务内部代码占用比较多的时间片资源从而导致别的任务得不到调度,进一步也实现了按优先级调度的策略。
   
   **Describe alternatives you've considered (描述你想到的折衷方案)**
   
有一种折中的方式是自己搞一个线程池,bthread只用于brpc/braft等协议的交互,对于内部比如要写盘这些重IO操作的,可以丢到自己的线程池中去实现。但这里也有个性能问题就是会涉及到多次bthread<->pthread的来回切换,而且遇到锁的处理mutex/bmutex必须非常小心,否则特别容易出现死锁的问题。
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to