Skip to content

Add business QoS configuration for URMA - #3712

Open
Spicy-cream wants to merge 43 commits into
apache:masterfrom
LinQuickDev:feature/rdma-business-qos
Open

Spicy-cream wants to merge 43 commits into
apache:masterfrom
LinQuickDev:feature/rdma-business-qos

Conversation

@Spicy-cream

@Spicy-cream Spicy-cream commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

A process can serve latency-sensitive RPCs alongside bulk traffic. Channel and server options let each workload set its outgoing priority, with the process default available for other traffic.

This PR depends on PR3708. The source branch includes its recovery changes; merge PR3708 first.

What is changed and the side effects?

  • Add ChannelOptions and ServerOptions settings for outgoing SL 0-255 and priority 0-15; -1 selects automatic behavior. Channels configure request traffic, and servers configure response traffic.
  • Resolve SL through the selected CTP/RTP device mapping. Reject unsupported, conflicting or out-of-range settings during Channel initialization or Server startup, with supported priority:SL pairs in diagnostics.
  • Include QoS in connection signatures and propagate it through naming services, accepted sockets and rebuilt Jettys. Use prepared Jettys only when their priority matches.
  • Propagate QoS through GetSubSocketOptions() so pooled/short children retain QoS alongside keepalive, TCP user timeout and bthread tag settings.
  • Expose requested/effective values in diagnostics and examples, and add independent QoS and connection-lifecycle regressions.

The selected path exposes up to 16 priority/SL mappings per device. Live URMA connections each use a Jetty at each end. Connections with the default priority and compatible queues can use a prepared Jetty. Other connections allocate Jettys on demand. The channel signature includes the configured priority and SL, so equivalent settings can use separate connections. Existing v2/v3 wire formats remain compatible.

Validation

  • The local URMA mock suite passed all 22 regression groups with RDMA disabled, including the inherited recovery regressions.
  • The RTP/polling QoS churn suite passed 100 complete runs after the inherited mock SEND fix.
  • A regression verifies QoS, keepalive snapshots, TCP user timeout and bthread tag propagation to pooled and short sockets. All 3 existing community Socket option tests passed; their sources remain unchanged.
  • Library/example builds and C++14 compilation checks passed, including public headers with transports disabled.
  • Mock lifecycle regressions cover small-pool v2/v3 short connections and request SL 4/response SL 2 across TCP cooldown and fresh URMA connections.
  • Prior URMA RM/RTP hardware runs passed all 12 event/polling, v2/v3 and auto/SL/SL-plus-priority RPC cases, plus all 6 client/server configuration-rejection cases. A live server connection reported ESTABLISHED with effective priority 2 and SL 2.

Design discussion: URMA runtime recovery and business QoS configuration.

Check List

  • Build the library/examples and run related regressions.
  • Add independent tests, preserve existing community UT sources and update documentation.
  • Follow four-space indentation and C++ nullptr conventions.

@wwbmmm

wwbmmm commented Nov 7, 2026

Copy link
Copy Markdown
Contributor
  1. This PR is not reviewable as a QoS change. Its ~4.5k added lines also carry the runtime-recovery work from Add URMA runtime recovery and TCP fallback #3708 plus changes unrelated to QoS: --urma_tp_type path selection, --urma_copy_send, the recovery policy, the send-failure injection harness, and a new .github/workflows/ci-urma.yml. Please merge Add URMA runtime recovery and TCP fallback #3708 first and rebase so this PR contains only the QoS delta, and keep the CI workflow in the PR that introduces the recovery support. Otherwise reviewers cannot separate what QoS needs from what the dependency already provides.

  2. Adding UrmaQosOptions to ChannelOptions, ServerOptions, SocketOptions and Acceptor makes this a public API change on the core headers (channel.h/server.h/socket.h now include brpc/urma/urma_qos.h). The requirement is reasonable, but the PR should justify why a process-level default (the current behavior, which can stay a flag) is insufficient and how many distinct settings a process can carry: each distinct (priority, SL) combination needs its own Jetty per device, and prepared-Jetty reuse is already made conditional on a priority match, so every business channel with a custom priority adds Jetty creation/teardown cost. Please document the expected bound and the behavior when a device exposes few priorities.

@Spicy-cream

Copy link
Copy Markdown
Contributor Author
  1. This PR is not reviewable as a QoS change. Its ~4.5k added lines also carry the runtime-recovery work from Add URMA runtime recovery and TCP fallback #3708 plus changes unrelated to QoS: --urma_tp_type path selection, --urma_copy_send, the recovery policy, the send-failure injection harness, and a new .github/workflows/ci-urma.yml. Please merge Add URMA runtime recovery and TCP fallback #3708 first and rebase so this PR contains only the QoS delta, and keep the CI workflow in the PR that introduces the recovery support. Otherwise reviewers cannot separate what QoS needs from what the dependency already provides.
  2. Adding UrmaQosOptions to ChannelOptions, ServerOptions, SocketOptions and Acceptor makes this a public API change on the core headers (channel.h/server.h/socket.h now include brpc/urma/urma_qos.h). The requirement is reasonable, but the PR should justify why a process-level default (the current behavior, which can stay a flag) is insufficient and how many distinct settings a process can carry: each distinct (priority, SL) combination needs its own Jetty per device, and prepared-Jetty reuse is already made conditional on a priority match, so every business channel with a custom priority adds Jetty creation/teardown cost. Please document the expected bound and the behavior when a device exposes few priorities.

Thanks for the review. I’ll move the mock SEND completion fix and its CI wiring to #3708, then rebase this PR after #3708 lands so the diff contains only the QoS changes.

The use case is a single process with both latency-sensitive RPCs and bulk traffic. Those channels need different outgoing priorities, while channels with no explicit setting can inherit the process default.

I’ll document the device limits and resource cost. The selected device and path expose up to 16 effective priority/SL mappings, and unsupported settings fail initialization with the available mappings in the diagnostic. Jetty usage scales with live URMA connections and the prepared pool. Connections with non-default priorities allocate Jettys on demand.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical concurrency issue remains because the global mutex is held during a potentially blocking JFCE read, which can stall teardown and other mock URMA operations.

1 open issue
What changed in this PR

This PR adds configurable business-level URMA QoS for request and response traffic while extending runtime recovery, transport-path selection, connection lifecycle handling, and mock-based validation.

Changes:

  • Adds priority and service-level configuration to channels, servers, sockets, accepted connections, pooled sockets, and short connections.
  • Implements capability-based CTP/RTP selection, QoS validation and diagnostics, connection-signature isolation, prepared-Jetty matching, and handshake propagation.
  • Adds recovery policies, TCP fallback behavior, mock-provider and lifecycle regressions, fault-injection tooling, documentation, examples, and CI coverage.
File Description
test/​CMakeLists.txt Registers URMA transport, recovery, QoS, churn, completion, copy, and fault-injection test variants.
test/​brpc_urma_transport_unittest.cpp Tests URMA transport paths, handshakes, payload exchange, and recovery behavior.
test/​brpc_urma_runtime_unittest.cpp Tests URMA runtime helpers, validation, copied sends, resource handling, recovery, and fallback behavior.
test/​brpc_urma_remote_recovery_unittest.cpp Tests client recovery and fallback after injected server SEND failures.
test/​brpc_urma_recovery_unittest.cpp Tests recovery policy modes, cooldowns, epochs, eviction, metrics, and concurrency.
test/​brpc_urma_qos_unittest.cpp Tests QoS mapping, validation, propagation, diagnostics, and prepared-Jetty behavior.
test/​brpc_urma_qos_churn_unittest.cpp Tests QoS preservation through short-connection churn, cooldown, and reconnection.
test/​brpc_urma_mock_completion_unittest.cpp Tests mock completion ordering, provider backpressure, and credit acknowledgements.
test/​brpc_urma_copy_unittest.cpp Tests copied-send payload and attachment handling.
src/​brpc/​urma/​urma_recovery_policy.h Declares URMA recovery modes, failure reasons, status, and policy interfaces.
src/​brpc/​urma/​urma_recovery_policy.cpp Implements recovery admission, peer cooldowns, metrics, epochs, and failure accounting.
src/​brpc/​urma/​urma_qos.h Defines public URMA priority and service-level QoS options.
src/​brpc/​urma/​urma_helper.h Declares URMA path-selection, QoS-resolution, SGE, and copied-send helpers.
src/​brpc/​urma/​urma_helper.cpp Implements capability discovery, path selection, QoS mapping, diagnostics, buffer handling, and initialization helpers.
src/​brpc/​urma/​urma_handshake.cpp Adds fallback signaling for v2 and v3 handshakes.
src/​brpc/​urma/​urma_endpoint.h Adds endpoint state for recovery, QoS diagnostics, CQ synchronization, and acknowledgement flushing.
src/​brpc/​urma/​mock_urma.cpp Extends the mock provider with QoS capabilities, synchronized operations, realistic resources, completion ordering, and backpressure.
src/​brpc/​urma_transport.cpp Validates and resolves channel and server QoS while creating per-socket URMA connections.
src/​brpc/​socket.h Adds QoS configuration and state to socket interfaces.
src/​brpc/​socket.cpp Validates and propagates QoS to pooled, child, and short sockets.
src/​brpc/​server.h Adds response-side URMA QoS configuration to ServerOptions.
src/​brpc/​server.cpp Validates server QoS and transfers it to accepted connections.
src/​brpc/​channel.h Adds request-side URMA QoS configuration to ChannelOptions.
src/​brpc/​channel.cpp Includes QoS in channel signatures and propagates it to socket and naming-service options.
src/​brpc/​acceptor.h Stores server URMA QoS settings in the acceptor.
src/​brpc/​acceptor.cpp Applies acceptor QoS to newly accepted sockets.
example/​urma_performance/​test_send_failure_injector.c Adds self-test coverage for the SEND failure injector.
example/​urma_performance/​test_run_recovery_injection.py Tests recovery-runner parsing, phase validation, and readiness handling.
example/​urma_performance/​server.cpp Adds server-side URMA priority and service-level command-line options.
example/​urma_performance/​send_failure_injector.c Provides an LD_PRELOAD SEND failure injector.
example/​urma_performance/​run_recovery_injection.py Runs and validates end-to-end URMA recovery injection scenarios.
example/​urma_performance/​recovery_client.cpp Adds a configurable URMA recovery and attachment-validation client.
example/​urma_performance/​CMakeLists.txt Builds the recovery client and optional fault-injection tools and tests.
example/​urma_performance/​client.cpp Adds client-side URMA priority and service-level command-line options.
docs/​en/​urma.md Documents URMA path selection, recovery, QoS configuration, diagnostics, and validation.
docs/​cn/​urma.md Adds corresponding Chinese URMA documentation.
.github/​workflows/​ci-urma.yml Adds Linux URMA mock-provider build and regression-test CI coverage.

Review effort: Lite

Comment on lines +705 to 709
std::shared_lock<std::shared_mutex> lock(g_rw_mutex);
if (!jfce || !jfcs || jfc_cnt == 0 || jfce_map.count(jfce) == 0) {
errno = EINVAL;
return -1;
}
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.

3 participants