Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epoll bthread deal first #2819

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

zhengJade
Copy link
Contributor

@zhengJade zhengJade commented Nov 13, 2024

What problem does this PR solve?

对 brpc 性能做了提升

Problem Summary:
目前的 brpc 网络事件存在两个问题

  1. epoll 线程和其他 bthread 具有相同优先级,导致 epoll 线程可能被一小段时间在队列中无响应,引起 worker queue 任务数量分布不均匀,多对一的 steal。
  2. 网络事件无差别 signal,增加了系统调用。

What is changed and the side effects?

epoll 线程不在 queue 中,独立出来

Side effects:

  • Performance effects(性能影响): 性能平均提升 20%-25%

  • Breaking backward compatibility(向后兼容性): 兼容

压测结果

  • worker num:9
  • core: 64
  • arch: Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
  • 工具 rpc_press
  • proto: echo

优化前

  • 1w
    image
  • 5w
    image
  • 10w
    image

优化后

1w
image

  • 5w
    image
  • 10w
    image

Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

bool except_state = true;
// epoll tid should be stolen first.
for (auto &epoll_state : _epoll_tid_states[tag]) {
if (epoll_state.second.compare_exchange_strong(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool except_state = true;是不是应该在这个循环里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants