apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.56k stars 3.98k forks source link

Optimize keytablelist implementation #2768

Closed MJY-HUST closed 1 month ago

MJY-HUST commented 2 months ago

What problem does this PR solve?

Issue Number: #2756

Problem Summary:

What is changed and the side effects?

Changed:

Side effects:


Check List:

wwbmmm commented 2 months ago

补充一些单测吧,感觉现有的单测没有覆盖到新增的代码

MJY-HUST commented 2 months ago

补充一些单测吧,感觉现有的单测没有覆盖到新增的代码

补充了两个单测: 场景一:启动多个bthread,获取keytable后bthread_usleep,模拟issue中的场景 场景二:启动多个bthread,一组bthread直接调用borrow_keytable获取keytable并存放到全局链表,另一组从全局链表中获取keytable并return_keytable,这些bthread理论上都不会发生切换,来模拟keytable不均衡的场景。 两个场景均检查thread local list的长度小于bthread::FLAGS_key_table_list_size

MJY-HUST commented 2 months ago

缩进改成4个空格吧

已修改

wwbmmm commented 2 months ago

LGTM

chenBright commented 1 month ago

@lsdh-fei 可以验证一下这个PR能否解决#2756 的问题吗?