-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat: add io_uring transport layer support #3328
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -51,6 +51,9 @@ DEFINES = [ | |||
| }) + select({ | ||||
| "//bazel/config:brpc_with_rdma": ["BRPC_WITH_RDMA=1"], | ||||
| "//conditions:default": [], | ||||
| }) + select({ | ||||
| "//bazel/config:brpc_with_iouring": ["BRPC_WITH_IOURING=1"], | ||||
| "//conditions:default": ["BRPC_WITH_IOURING=0"], | ||||
| }) + select({ | ||||
| "//bazel/config:brpc_with_debug_bthread_sche_safety": ["BRPC_DEBUG_BTHREAD_SCHE_SAFETY=1"], | ||||
| "//conditions:default": ["BRPC_DEBUG_BTHREAD_SCHE_SAFETY=0"], | ||||
|
|
@@ -94,6 +97,11 @@ LINKOPTS = [ | |||
| "-libverbs", | ||||
| ], | ||||
| "//conditions:default": [], | ||||
| }) + select({ | ||||
| "//bazel/config:brpc_with_iouring": [ | ||||
| "-luring", | ||||
| ], | ||||
| "//conditions:default": [], | ||||
| }) + select({ | ||||
| "//bazel/config:brpc_with_asan": ["-fsanitize=address"], | ||||
| "//conditions:default": [], | ||||
|
|
@@ -530,18 +538,33 @@ cc_library( | |||
| "src/brpc/policy/thrift_protocol.cpp", | ||||
| "src/brpc/event_dispatcher_epoll.cpp", | ||||
| "src/brpc/event_dispatcher_kqueue.cpp", | ||||
| "src/brpc/iouring/*.cpp", | ||||
| # Exclude pre-generated .pb.cc files; Bazel regenerates them via | ||||
| # brpc_internal_cc_proto / brpc_idl_options_cc_proto using protoc 27.x. | ||||
| "src/brpc/*.pb.cc", | ||||
| "src/brpc/**/*.pb.cc", | ||||
|
Comment on lines
+542
to
+545
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be a false question. brpc has been using protobuf 27.3 in MOUDLE.bazel for a long time and it compiles successfully in CI. These pb.cc files are probably not generated by bazel; they might be generated by compiling with make. Line 11 in 72adb6e
|
||||
| ]) + select({ | ||||
| "//bazel/config:brpc_with_thrift": glob([ | ||||
| "src/brpc/thrift*.cpp", | ||||
| "src/brpc/**/thrift*.cpp", | ||||
| ]), | ||||
| "//conditions:default": [], | ||||
| }) + select({ | ||||
| "//bazel/config:brpc_with_iouring": glob([ | ||||
| "src/brpc/iouring/*.cpp", | ||||
| ]), | ||||
| "//conditions:default": [], | ||||
|
Comment on lines
+552
to
+556
|
||||
| }), | ||||
| hdrs = glob([ | ||||
| "src/brpc/*.h", | ||||
| "src/brpc/**/*.h", | ||||
| "src/brpc/event_dispatcher_epoll.cpp", | ||||
| "src/brpc/event_dispatcher_kqueue.cpp", | ||||
| ], exclude = [ | ||||
| # Exclude pre-generated .pb.h files; Bazel uses the ones regenerated by | ||||
| # brpc_internal_cc_proto / brpc_idl_options_cc_proto (protoc 27.x). | ||||
| "src/brpc/*.pb.h", | ||||
| "src/brpc/**/*.pb.h", | ||||
|
Comment on lines
+563
to
+567
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be a false question. brpc has been using protobuf 27.3 in MOUDLE.bazel for a long time and it compiles successfully in CI. These pb.h files are probably not generated by bazel; they might be generated by compiling with make. Line 11 in 72adb6e
|
||||
| ]), | ||||
| copts = COPTS, | ||||
| includes = [ | ||||
|
|
@@ -562,6 +585,11 @@ cc_library( | |||
| "@org_apache_thrift//:thrift", | ||||
| ], | ||||
| "//conditions:default": [], | ||||
| }) + select({ | ||||
| "//bazel/config:brpc_with_iouring": [ | ||||
| "@com_github_axboe_liburing//:liburing", | ||||
| ], | ||||
| "//conditions:default": [], | ||||
| }), | ||||
| ) | ||||
|
|
||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ bazel_dep(name = 'platforms', version = '0.0.4') | |
| bazel_dep(name = "apple_support", version = "1.17.1") | ||
| bazel_dep(name = 'rules_cc', version = '0.0.1') | ||
| bazel_dep(name = 'rules_proto', version = '4.0.0') | ||
| bazel_dep(name = 'rules_foreign_cc', version = '0.12.0') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| bazel_dep(name = 'zlib', version = '1.3.1.bcr.5', repo_name = 'com_github_madler_zlib') | ||
| bazel_dep(name = 'babylon', version = '1.4.4') | ||
| # --registry=https://raw.githubusercontent.com/apache/brpc/master/registry | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # In Bzlmod mode (MODULE.bazel), Bazel reads this file instead of WORKSPACE | ||
| # for any legacy http_archive / new_local_repository declarations that are not | ||
| # yet available in a Bazel registry. | ||
| # | ||
| # rules_foreign_cc is declared in MODULE.bazel (bazel_dep) and is available | ||
| # as @rules_foreign_cc in Bzlmod mode -- no need to re-declare it here. | ||
|
|
||
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
|
||
| # io_uring support. Enable with: --define=BRPC_WITH_IOURING=true | ||
| # liburing is built from source via configure+make (compat.h is generated by | ||
| # configure and is not present in the tarball). | ||
| http_archive( | ||
| name = "com_github_axboe_liburing", | ||
| build_file = "//bazel/third_party/liburing:liburing.BUILD", | ||
| sha256 = "5f80964108981c6ad979c735f0b4877d5f49914c2a062f8e88282f26bf61de0c", | ||
| strip_prefix = "liburing-liburing-2.14", | ||
| urls = ["https://github.com/axboe/liburing/archive/refs/tags/liburing-2.14.tar.gz"], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # This package exists solely to expose liburing.BUILD as a build_file label | ||
| # for the com_github_axboe_liburing http_archive rule. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # BUILD file for liburing (io_uring userspace library). | ||
| # Uses rules_foreign_cc to run liburing's ./configure + make, which is required | ||
| # because compat.h (providing __kernel_timespec on older kernels) is generated | ||
| # by the configure script and is not present in the source tarball. | ||
|
|
||
| load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make") | ||
|
|
||
| licenses(["notice"]) # MIT / GPL-2.0-only (dual-licensed) | ||
|
|
||
| filegroup( | ||
| name = "all_srcs", | ||
| srcs = glob(["**"]), | ||
| ) | ||
|
|
||
| configure_make( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The liburing BUILD.bazel implementation in the bazel central registry is better. |
||
| name = "liburing", | ||
| configure_command = "configure", | ||
| configure_in_place = True, | ||
| lib_source = ":all_srcs", | ||
| # Build only the library (skip test/ and examples/) then install. | ||
| targets = ["library", "install"], | ||
| out_static_libs = ["liburing.a"], | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to display the connection during. In brpc BUILD.bazel, you only need to depend on liburing in deps.