zhoukangsheng commented on issue #1906:
URL: 
https://github.com/apache/incubator-brpc/issues/1906#issuecomment-1228014847

   
   
   
   > 动态回收pthread 
worker在实践中会有一些困难,比如无法把待回收的pthread上正在执行的bthread强制调度走(bthread是主动让出),比如如何回收pthread上面的tls变量(有些是业务创建的,没有释放机制),所以没有支持worker动态调小,要调小只能重启
   
   
嗯嗯,这些确实是要考虑的问题;能否在收到worker调小的通知后,随机选取几个线程进行标记,之后不再往标记的线程分配bthread任务就可以达到worker调小的目的,不知道这个思路是否可行?另外我们在使用brpc框架时,我们不建议业务代码使用tls变量,当一个bthread被多个线程调度到后,访问tls变量会存在一些未定义的行为;对于一些需要使用tls变量的场景,比如trace,我们参考brpc中的tls在bthread中做了一些二次开发,在bthread切换调度线程时,将tls变量保存在了bthread的context中,当它被其它线程调度到时,再从context中恢复到tls。


-- 
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