feat: add io_uring transport layer support#3328
Open
yanglimingcn wants to merge 1 commit into
Open
Conversation
39974f0 to
b36cc26
Compare
Add a new io_uring-based transport layer (IouringTransport) as an
alternative to the existing TCP and RDMA transports, following the
same architectural patterns as the RDMA implementation.
Core implementation:
- src/brpc/iouring/iouring_endpoint.h/cpp: IouringEndpoint (SocketUser
subclass) that submits async read/write SQEs and reaps CQEs, with
optional SQPOLL polling mode.
- src/brpc/iouring/iouring_helper.h/cpp: global io_uring ring lifecycle
management, per-bthread-tag poller threads, and availability checks.
- src/brpc/iouring_transport.h/cpp: IouringTransport (Transport
interface) wiring Init/Release/Reset/Connect/CutFromIOBuf(List)/
WaitEpollOut/ProcessEvent/QueueMessage/Debug/ContextInitOrDie.
Build system integration:
- CMakeLists.txt: BRPC_WITH_IOURING option; find_package(liburing);
conditionally compile iouring sources and link -luring.
- BUILD.bazel / bazel/config/BUILD.bazel: brpc_with_iouring
config_setting; conditional srcs/defines/linkopts/deps.
- WORKSPACE: new_local_repository for @com_github_axboe_liburing.
- bazel/third_party/liburing/liburing.BUILD: cc_library target for
liburing.
Framework hooks:
- src/brpc/socket_mode.h: add SOCKET_MODE_IOURING enum value.
- src/brpc/transport_factory.cpp: register IouringTransport in
TransportFactory::Create().
- src/brpc/socket.h: friend declarations for IouringEndpoint /
IouringTransport.
- src/brpc/input_messenger.h: friend declarations for IouringEndpoint /
IouringTransport.
Bug fixes:
- src/butil/single_threaded_pool.h: rename static member BLOCK_SIZE to
POOL_BLOCK_SIZE to avoid conflict with the BLOCK_SIZE macro defined
by <linux/fs.h> (pulled in via liburing.h).
- src/brpc/iouring_transport.cpp: move DECLARE_bool(usercode_in_*)
inside namespace brpc{} to match the DEFINE_bool site in
event_dispatcher.cpp, fixing linker undefined-reference errors.
Example and documentation:
- example/iouring_performance/: server, client, proto, CMakeLists.txt
mirroring the rdma_performance example; supports WITH_IOURING=1 make
flag.
- example/BUILD.bazel: Bazel targets for the new example.
- docs/cn/iouring.md: Chinese-language guide covering build, flags,
architecture and comparison with RDMA.
b36cc26 to
0e65397
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a new io_uring-based transport layer (IouringTransport) as an alternative to the existing TCP and RDMA transports, following the same architectural patterns as the RDMA implementation.
Core implementation:
Build system integration:
Framework hooks:
Bug fixes:
Example and documentation:
What problem does this PR solve?
Issue Number:
#1650
#3212
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: