This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b089587 Add rdma_performance bazel support (#1984)
4b089587 is described below

commit 4b08958753e4ad1fd2f5bbb9bfc60b7be268016f
Author: 372046933 <[email protected]>
AuthorDate: Wed Nov 9 10:10:04 2022 +0800

    Add rdma_performance bazel support (#1984)
    
    * Add rdma_performance bazel support
    
    * Fix CI
---
 docs/cn/rdma.md     |  8 ++++++++
 docs/en/rdma.md     |  8 ++++++++
 example/BUILD.bazel | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+)

diff --git a/docs/cn/rdma.md b/docs/cn/rdma.md
index 0c5dd96c..645b285e 100644
--- a/docs/cn/rdma.md
+++ b/docs/cn/rdma.md
@@ -21,6 +21,14 @@ mkdir bld && cd bld && cmake ..
 make
 ```
 
+使用bazel:
+```bash
+# Server
+bazel build example:rdma_performance_server
+# Client
+bazel build example:rdma_performance_client
+```
+
 # 基本实现
 
 
RDMA与TCP不同,不使用socket接口进行通信。但是在实现上仍然复用了brpc中原本的Socket类。当用户选择ChannelOptions或ServerOptions中的use_rdma为true时,创建出的Socket类中则有对应的RdmaEndpoint(参见src/brpc/rdma/rdma_endpoint.cpp)。当RDMA被使能时,写入Socket的数据会通过RdmaEndpoint提交给RDMA
 QP(通过verbs API),而非拷贝到fd。对于数据读取,RdmaEndpoint中则调用verbs API从RDMA 
CQ中获取对应完成信息(事件获取有独立的fd,复用EventDispatcher,处理函数采用RdmaEndpoint::PollCq),最后复用InputMessenger完成RPC消息解析。
diff --git a/docs/en/rdma.md b/docs/en/rdma.md
index d705b71e..e76a01de 100644
--- a/docs/en/rdma.md
+++ b/docs/en/rdma.md
@@ -21,6 +21,14 @@ mkdir bld && cd bld && cmake ..
 make
 ```
 
+With bazel:
+```bash
+# Server
+bazel build example:rdma_performance_server
+# Client
+bazel build example:rdma_performance_client
+```
+
 # Basic Implementation
 
 RDMA does not use socket API like TCP. However, the brpc::Socket class is 
still used. If a user sets ChannelOptions.use_rdma or ServerOptions.use_rdma to 
true, the Socket class created has RdmaEndpoint (see 
src/brpc/rdma/rdma_endpoint.cpp). When RDMA is enabled, the data which need to 
transmit will be posted to RDMA QP with verbs API, not written to TCP fd. For 
data receiving, RdmaEndpoint will get completions from RDMA CQ with verbs API 
(the event will be generated from a dedicated fd a [...]
diff --git a/example/BUILD.bazel b/example/BUILD.bazel
index 5ef87e0a..afc525a3 100644
--- a/example/BUILD.bazel
+++ b/example/BUILD.bazel
@@ -32,6 +32,9 @@ COPTS = [
 ] + select({
     "//bazel/config:brpc_with_glog": ["-DBRPC_WITH_GLOG=1"],
     "//conditions:default": ["-DBRPC_WITH_GLOG=0"],
+}) + select({
+    "//bazel/config:brpc_with_rdma": ["-DBRPC_WITH_RDMA=1"],
+    "//conditions:default": [""],
 })
 
 proto_library(
@@ -41,6 +44,13 @@ proto_library(
     ],
 )
 
+proto_library(
+    name = "rdma_performance_proto",
+    srcs = [
+        "rdma_performance/test.proto",
+    ],
+)
+
 cc_proto_library(
     name = "cc_echo_c++_proto",
     deps = [
@@ -48,6 +58,13 @@ cc_proto_library(
     ],
 )
 
+cc_proto_library(
+    name = "cc_rdma_performance_proto",
+    deps = [
+        ":rdma_performance_proto",
+    ],
+)
+
 cc_binary(
     name = "echo_c++_server",
     srcs = [
@@ -77,3 +94,33 @@ cc_binary(
         "//:brpc",
     ],
 )
+
+cc_binary(
+    name = "rdma_performance_server",
+    srcs = [
+        "rdma_performance/server.cpp",
+    ],
+    includes = [
+        "rdma_performance",
+    ],
+    copts = COPTS + ["-DBRPC_WITH_RDMA=1"],
+    deps = [
+        ":cc_rdma_performance_proto",
+        "//:brpc",
+    ],
+)
+
+cc_binary(
+    name = "rdma_performance_client",
+    srcs = [
+        "rdma_performance/client.cpp",
+    ],
+    includes = [
+        "rdma_performance",
+    ],
+    copts = COPTS + ["-DBRPC_WITH_RDMA=1"],
+    deps = [
+        ":cc_rdma_performance_proto",
+        "//:brpc",
+    ],
+)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to