Skip to content

rdma support polling mode#2920

Merged
wwbmmm merged 1 commit intoapache:masterfrom
yanglimingcn:feature/rdma_support_polling
Jun 20, 2025
Merged

rdma support polling mode#2920
wwbmmm merged 1 commit intoapache:masterfrom
yanglimingcn:feature/rdma_support_polling

Conversation

@yanglimingcn
Copy link
Copy Markdown
Contributor

@yanglimingcn yanglimingcn commented Mar 19, 2025

What problem does this PR solve?

Issue Number:
#1434 #2344 #1650
Problem Summary:

RDMA支持Polling模式,使用bRPC的rdma测试工具能看到延迟明显降低。如果希望做到run-to-completion模型,需要把使用rdma的Server线程数设置成2(epoll bthread独占一个线程,另一个线程给rdma poller bthread和所有请求的bthread。),如果需要调用spdk/io_uring等异步驱动,需要设置rdma::SetPollingModeCallback, 并且设置rdma_poller_yield为true。

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

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


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.(请遵循贡献者准则).

@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch from 2a5dbe9 to 85cab8a Compare March 19, 2025 07:12
Comment thread src/brpc/rdma/rdma_endpoint.cpp Outdated
Comment thread src/brpc/socket.cpp
Comment thread src/brpc/rdma/rdma_endpoint.cpp Outdated
Comment thread src/brpc/rdma/rdma_endpoint.cpp Outdated
@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch from 85cab8a to ddc1d5b Compare March 19, 2025 11:22
Comment thread src/brpc/rdma/rdma_endpoint.cpp Outdated
Comment thread src/brpc/rdma/rdma_endpoint.cpp Outdated
@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch from ddc1d5b to c715949 Compare March 20, 2025 02:17
Comment thread src/brpc/rdma/rdma_endpoint.h Outdated
@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch 12 times, most recently from 0184757 to 6bb5d08 Compare March 24, 2025 02:30
@wwbmmm
Copy link
Copy Markdown
Contributor

wwbmmm commented Mar 24, 2025

@Tuvie 有空看看

@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch 7 times, most recently from 87db342 to 4ec6954 Compare March 24, 2025 09:43
@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch from 4ec6954 to cbf674a Compare April 3, 2025 13:14
@yanglimingcn
Copy link
Copy Markdown
Contributor Author

@Tuvie 有空看看

@wwbmmm @Tuvie 这个有时间看看吧。

@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch from cbf674a to df04aa4 Compare April 12, 2025 04:16
@LinyuWang
Copy link
Copy Markdown

请问有办法给 rdma 的 poller 做绑核么? 绑核后,预期效果会更好吧?

@LinyuWang
Copy link
Copy Markdown

我来同步一下我这边使用 rdma + polling 的测试结果。
基础环境: ubuntu 22.04, cx6 网卡,单port 100Gb/s, 双路总共 192core CPU
业务场景:大模型推理
测试工具: brpc/example/rdma_performance
具体数据:
【不使用 polling mode】
[Threads: 1, Depth: 1, Attachment: 4096B, RDMA: yes, Echo: yes]
Avg-Latency: 56, 90th-Latency: 73, 99th-Latency: 84, 99.9th-Latency: 143, Throughput: 70.9391MB/s, QPS: 18k, Server CPU-utilization: 53%, Client CPU-utilization: 69%
【使用 polling mode】
[Threads: 1, Depth: 1, Attachment: 4096B, RDMA: yes, Echo: yes]
Avg-Latency: 10, 90th-Latency: 11, 99th-Latency: 13, 99.9th-Latency: 24, Throughput: 345.172MB/s, QPS: 88k, Server CPU-utilization: 1600%, Client CPU-utilization: 100%

注意:服务端我给了 16 个 poller, 因此服务端 cpu 使用率是 1600%

@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch 4 times, most recently from 250c4ad to b282a32 Compare May 3, 2025 00:08
@wwbmmm
Copy link
Copy Markdown
Contributor

wwbmmm commented May 3, 2025

LGTM

Comment thread src/brpc/rdma/rdma_endpoint.cpp Outdated
Comment thread src/brpc/rdma/rdma_endpoint.cpp Outdated
Comment thread src/brpc/rdma/rdma_endpoint.cpp
Copy link
Copy Markdown

@szy441687879 szy441687879 left a comment

Choose a reason for hiding this comment

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

我们正在用这个commit加上spdk尝试实现存储的run to complete模型,发现有几个问题,辛苦帮忙看一下

@yanglimingcn
Copy link
Copy Markdown
Contributor Author

你们具体怎么用的呢,每个分组一块盘吗?每个盘一个worker?

@yanglimingcn
Copy link
Copy Markdown
Contributor Author

我们正在用这个commit加上spdk尝试实现存储的run to complete模型,发现有几个问题,辛苦帮忙看一下

可以在bRPC群里面找我,加个微信,这样聊更方便些。

@szy441687879
Copy link
Copy Markdown

你们具体怎么用的呢,每个分组一块盘吗?每个盘一个worker?

每个盘一个worker

@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch 5 times, most recently from 342710f to caa1fe9 Compare May 20, 2025 06:50
@yanglimingcn yanglimingcn force-pushed the feature/rdma_support_polling branch from caa1fe9 to 41d7ec7 Compare May 21, 2025 10:42
@szy441687879
Copy link
Copy Markdown

szy441687879 commented May 21, 2025

感谢@yanglimingcn,我们使用这个cr在高性能存储场景实现了run-to-completion模型(with spdk),对比事件模式在延时方面确实有了显著的改善。
测试环境:CentOS Stream 9,网卡Mellanox MT2892(200G*2),磁盘dapustor H5100
业务场景:高性能存储
具体数据:
在128k写入,1w qps的情况下
【不使用 polling mode】
Avg-Latency: 115, 90th-Latency: 125, 99th-Latency: 131, 99.9th-Latency: 134
【使用 polling mode】
Avg-Latency: 82, 90th-Latency: 84, 99th-Latency: 87, 99.9th-Latency: 89

在4k写入,1w qps的情况下
【不使用 polling mode】
Avg-Latency: 55, 90th-Latency: 57, 99th-Latency: 60, 99.9th-Latency: 156
【使用 polling mode】
Avg-Latency: 36, 90th-Latency: 38, 99th-Latency: 40, 99.9th-Latency: 140

可以看到polling-mode在高性能存储场景可以给业务带来20us+延时的收益

@yanglimingcn
Copy link
Copy Markdown
Contributor Author

请问有办法给 rdma 的 poller 做绑核么? 绑核后,预期效果会更好吧?

bool InitPollingModeWithTag(bthread_tag_t tag,
std::function<void(void)> callback = nullptr,
std::function<void(void)> init_fn = nullptr,
std::function<void(void)> release_fn = nullptr);
这个初始化函数里面可以传递三个调用,init_fn可以用来实现绑核的功能。

@wwbmmm wwbmmm merged commit 67057f8 into apache:master Jun 20, 2025
15 checks passed
@yanglimingcn
Copy link
Copy Markdown
Contributor Author

yanglimingcn commented Jul 31, 2025

#3047 @chenBright

@cbsheng
Copy link
Copy Markdown

cbsheng commented Aug 5, 2025

我们正在用这个commit加上spdk尝试实现存储的run to complete模型,发现有几个问题,辛苦帮忙看一下

可以在bRPC群里面找我,加个微信,这样聊更方便些。

@yanglimingcn 请问 bRPC 群怎么加?

@yanglimingcn
Copy link
Copy Markdown
Contributor Author

我们正在用这个commit加上spdk尝试实现存储的run to complete模型,发现有几个问题,辛苦帮忙看一下

可以在bRPC群里面找我,加个微信,这样聊更方便些。

@yanglimingcn 请问 bRPC 群怎么加?

你发我一下你的微信号,我邀请你进入。可以发邮箱liming.yang139.com

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.

7 participants