MJY-HUST commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2120363076
>
https://github.com/apache/brpc/blob/b601c89aec9042a1f509ddbdad478aa4e3f118fe/src/brpc/server.h#L170-L183
>
>
>
https://github.com/apache/brpc/blob/b601c89aec9042a1f509ddbdad478
MJY-HUST commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2120855523
改造bthread_keytable_pool_t,其中引入一个类似于Object_pool的成员,但是和Object_pool不同的是,它不是单例。这样就可以和
bthread_keytable_pool_t绑定。然后使用bthread_key_create记录KeyInfo时,将index保存到一个bthread_keytable_pool_t的成员中。这样既可以使
MJY-HUST commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2120990105
改造bthread_keytable_pool_t
,其中引入一个类似Object_pool的成员,通过在成员内部使用tls变量来避免加互斥锁。然后对bthread_keytable_pool_t
中的锁的使用从互斥锁改为读写锁,来维护destroyed的值。在return_keytable内使用读锁,bthread_keytable_pool_init,bthread_ke
chenBright commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121602397
> >
https://github.com/apache/brpc/blob/b601c89aec9042a1f509ddbdad478aa4e3f118fe/src/brpc/server.h#L170-L183
> >
> >
https://github.com/apache/brpc/blob/b601c89aec9042a1f509ddbdad4
chenBright commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121630465
> 改造bthread_keytable_pool_t
,其中引入一个类似Object_pool的成员,通过在成员内部使用tls变量来避免加互斥锁。然后对bthread_keytable_pool_t
中的锁的使用从互斥锁改为读写锁,来维护destroyed的值。在return_keytable内使用读锁,bthread_keytable_pool_init,bthrea
chenBright commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121640057
>
如果使用TLS的话,当server结束调用Join时,通过bthread_keytable_pool_destroy方法需要删除所有线程内保存的TLS
free_keytables才行,感觉也不是很方便?
用butil::ThreadLocal应该挺方便的吧。
bthread_keytable_pool_init的时候,new一个butil::Th
MJY-HUST commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121660473
> >
如果使用TLS的话,当server结束调用Join时,通过bthread_keytable_pool_destroy方法需要删除所有线程内保存的TLS
free_keytables才行,感觉也不是很方便?
>
> 用butil::ThreadLocal应该挺方便的吧。
bthread_keytable_pool_init的时候,new一个butil::
MJY-HUST commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121665236
> > 改造bthread_keytable_pool_t
,其中引入一个类似Object_pool的成员,通过在成员内部使用tls变量来避免加互斥锁。然后对bthread_keytable_pool_t
中的锁的使用从互斥锁改为读写锁,来维护destroyed的值。在return_keytable内使用读锁,bthread_keytable_pool_init,bthrea
MJY-HUST commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121670376
> >
我的理解,目前的实现是一个server会绑定一个全局的bthread_keytable_pool_t,在server的声明周期内,server和其生成的bthread使用同一个pool,在server结束时会销毁所有创建的KeyTable,通过bthread_keytable_pool_t内的链表;然后会从全局的KeyInfo中删除所有注册的Key。但是使用全局一个链表
chenBright commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121677162
> > >
如果使用TLS的话,当server结束调用Join时,通过bthread_keytable_pool_destroy方法需要删除所有线程内保存的TLS
free_keytables才行,感觉也不是很方便?
> >
> >
> > 用butil::ThreadLocal应该挺方便的吧。
bthread_keytable_pool_init
chenBright commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121703973
> 我看ResourcePool获取对象的模式是如下图,那么reserve时初始化多个全局的block是否可行。
ResourcePool也是单例哦。
> return_keytable时,加读锁的临界区是判断destroyed + 将对象返回给pool,感觉不能直接使用原子变量
嗯嗯,return_keytable和bthread_
MJY-HUST commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121738852
> > > >
如果使用TLS的话,当server结束调用Join时,通过bthread_keytable_pool_destroy方法需要删除所有线程内保存的TLS
free_keytables才行,感觉也不是很方便?
> > >
> > >
> > > 用butil::ThreadLocal应该挺方便的吧。
bthread_keytable_poo
chenBright commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2121822911
https://github.com/apache/brpc/blob/b601c89aec9042a1f509ddbdad478aa4e3f118fe/src/butil/thread_key.h#L144-L154
--
This is an automated message from the Apache Git Service.
To respond to
13 matches
Mail list logo