Repository navigation
Conversation
Bound tebench status polling for large DRAM RDMA batches with at least 32 request threads, spread batch registry locks over cache-line-aligned shards, and add an opt-in NIC-NUMA-local worker selector with independent per-NIC cursors. Preserve hot polling for smaller or less concurrent loads. Signed-off-by: Feng Ren <alogfans@users.noreply.github.com>
|
Thanks for putting this together — the analysis of the polling path is really helpful. Setup. One host, same layout as the PR (initiator and target on the same machine), DRAM, We were able to reproduce the headline result: PR + NIC-local vs base at 32 threads gave
For reference, runs with identical code paths (backoff not triggered) differed by 0.4% at A few thoughts, for your consideration:
Happy to rerun anything or share the raw logs and scripts if that would help. |
In the single-host ablation of #5595, tebench backoff accounted for most of the initiator CPU savings. Its automatic 32-thread/8-MiB threshold also changed the wait policy between adjacent benchmark points. Expose the same backoff through --poll_backoff, defaulting to hot polling. Restore the original 64 batch lock shards and remove the new alignment. The ablation showed no clear throughput gain from the larger shard count and slightly higher initiator CPU cost with hot polling. Keep NIC-local dispatch opt-in and document the request-size restriction and the single-host scope of the measurements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liqian Lin <jacklin78911@gmail.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
select()does two full scans over all workers and callsworker_node(i)twice per worker. In… · Newfallbackis anintbut is cast touint32_twhen initializingnext_[device]. If a caller… · Newselect()does two full scans over all workers and callsworker_node(i)twice per worker. In… · NewRdmaNumaLaneCursoris instantiated persubmitTransferTasks()call, so per-NIC cursor state… · New
What changed in this PR
This PR reduces host-side RDMA polling contention in tebench and adds an opt-in NIC-NUMA-local worker dispatch path for TENT RDMA to improve throughput/CPU efficiency under concurrency.
Changes:
- Add
tebench --poll_backoffto bound polling (128 busy polls, then 1µs sleeps) to reduce initiator CPU. - Add
transports/rdma/workers/prefer_nic_localto prefer worker lanes on the preselected NIC’s NUMA node via published worker CPU placement. - Add RDMA NUMA dispatch cursor utility + unit tests and documentation/config updates.
| File | Description |
|---|---|
| mooncake-transfer-engine/tent/tests/rdma_numa_dispatch_test.cpp | New gtest coverage for NUMA-aware lane selection behavior and fallbacks. |
| mooncake-transfer-engine/tent/tests/CMakeLists.txt | Build/register new rdma_numa_dispatch unit test. |
| mooncake-transfer-engine/tent/src/transport/rdma/workers.cpp | Publish each worker’s bound NUMA node after successful socket binding. |
| mooncake-transfer-engine/tent/src/transport/rdma/rdma_transport.cpp | Use NUMA-aware lane cursor when NIC is preselected and option enabled. |
| mooncake-transfer-engine/tent/include/tent/transport/rdma/workers.h | Expose boundNumaNode() accessor and store published NUMA node. |
| mooncake-transfer-engine/tent/include/tent/transport/rdma/params.h | Add prefer_nic_local worker parameter (default false). |
| mooncake-transfer-engine/tent/include/tent/transport/rdma/numa_dispatch.h | New lane cursor to round-robin within a NIC’s NUMA-local worker subset. |
| mooncake-transfer-engine/tent/config/transfer-engine.json | Document config knob prefer_nic_local default. |
| mooncake-transfer-engine/tent/config/rdma-worker-locality.md | New documentation describing NIC-local dispatch and poll backoff behavior. |
| mooncake-transfer-engine/benchmark/utils.h | Add XferBenchConfig::poll_backoff. |
| mooncake-transfer-engine/benchmark/utils.cpp | Add/parse --poll_backoff flag. |
| mooncake-transfer-engine/benchmark/tent_backend.h | Extend waitForBatch to accept a backoff toggle. |
| mooncake-transfer-engine/benchmark/tent_backend.cpp | Implement backoff behavior in waitForBatch and wire to config. |
Review effort: Lite
| int count = 0; | ||
| for (int i = 0; i < num_workers_; ++i) | ||
| if (worker_node(i) == node) ++count; | ||
| if (!count) return fallback; |
| if (!(initialized_ & bit)) { | ||
| next_[device] = static_cast<uint32_t>(fallback); | ||
| initialized_ |= bit; | ||
| } |
| const auto ordinal = next_[device]++ % static_cast<uint32_t>(count); | ||
| uint32_t current = 0; | ||
| for (int i = 0; i < num_workers_; ++i) { | ||
| if (worker_node(i) == node && current++ == ordinal) return i; | ||
| } |
| RdmaNumaLaneCursor numa_lanes(num_workers, | ||
| params_->workers.prefer_nic_local); |

Description
Concurrent host-memory RDMA spends CPU on repeated batch-status queries and can hand a preselected NIC's slices to workers on the other NUMA node. This PR addresses the baseline perftest-to-TENT efficiency gap with two focused changes:
tebench --poll_backoffflag. It queries eagerly for the first 128 polls, then requests a 1 us sleep between pending queries. The default uses hot polling across thread counts and batch sizes. The flag controls the benchmark caller's wait policy.transports/rdma/workers/prefer_nic_local(defaultfalse). For preselected NICs, select workers on the NIC's NUMA node using workers' published CPU placement. An independent cursor per NIC covers every matching lane even when NICs alternate. Missing placement falls back to the existing cursor. The option chooses a subset of worker/QP lanes per NIC and should be measured with representative competing traffic.Enable NIC-local dispatch with:
Single-host RDMA measurements from the initial revision
The table records the initial revision
a33d309. ItsPR defaultrows use the original automatic backoff gate and 1,024 shards. The current revision uses opt-in backoff and 64 shards.In the initial revision at 32 threads, NIC-local dispatch plus bounded polling improves read/write bandwidth by 6.94% / 4.67%, while initiator CPU time falls 72.53% / 73.02%. At eight threads, NIC-local dispatch improves read/write bandwidth by 4.72% / 1.38%.
Control-case tradeoffs: batch=1 write bandwidth is 1.10% lower by the three-run median; initiator CPU time is about 8% higher and write P99 is 9.73% higher. The smallest NIC-local batch=1 read sample is 73.33 GB/s, versus a 79.43 GB/s median. These cases retain hot polling; the table includes them to expose the measured tradeoffs.
All three-run throughput ranges (GB/s)
Measured from pristine main
fcb610ad35ea042a140e5f4eb255049f608f4e66and source tree6068e2ed88e5f534b8a9c6463afb6488839bd790(commita33d3096213a45530cace4549cbe666dd6acdac8) on a dual-NUMA Intel Xeon Platinum 8457C host, usingmlx5_1throughmlx5_4. One initiator and one fixed baseline target process share four NICs. Defaults remain six worker lanes and a 64 KiB base slice. Requests are 256 KiB; batch 32 is 8 MiB of logical payload. Both NUMA nodes allocate 1 GiB; each request thread uses its own source batch and random remote window (128 MiB at eight threads, 32 MiB at 32 threads). Rows are medians of three interleaved runs, 1 s warmup + 4 s timed transfer, with the same target retained for each group. GB/s is decimal; latency is per batch. CPU time is cumulative initiator-process user+system CPU seconds, including startup/warmup, while the target remains alive.The earlier raw
ib_read_bw/ib_write_bwsmall-address-window baseline was about 188.1 GB/s aggregate. A separate control with the message fixed at 256 KiB and only per-QP cyclic address windows enlarged to 32 MiB measured 175.51/177.10 GB/s (read/write). Address layout therefore matters to the residual gap; this PR reports measured TENT gains and does not equate unlike address working sets.The eight-thread control showed a 1.8% read bandwidth loss with backoff enabled. A follow-up single-host ablation found that backoff alone reduced initiator read CPU time from 180.5 s to 51.9 s at 32 threads. The original automatic gate changed CPU time from 176.6 s to 51.9 s between 31 and 32 threads. Increasing the shard count showed bandwidth changes of −1.2% to +1.6% and modestly higher CPU use with hot polling. This motivated the explicit flag and the return to 64 shards.
Related work
Suggested Merge Priority
Module
mooncake-transfer-engine)Type of Change
How Has This Been Tested?
Follow-up
62f7fd6. Builttebenchwith TENT enabled on Ubuntu 24.04 under WSL2. Passed 48 unit tests across the TENT progress-worker and tebench config, layout, and teardown suites. The build-tree CLI help test passed and reports--poll_backoffdefaulting tofalse. Two loopback TCP runs passed data consistency checks with backoff omitted and enabled, respectively. Changed-file pre-commit checks passed.Validation commands and results for the initial RDMA revision
Test commands:
Hardware integration is covered by the explicit mlx5_1..4 benchmark matrix rather than the unit test's automatic device selection. The existing CUDA-only tests skip when GPUs are hidden. New tests cover polling thresholds/overflow, sparse and unknown NUMA placement, startup publication, more than 64 workers, disabled fallback, and complete local-lane coverage under alternating NICs.
Representative two-process commands on the same host (use the target segment name printed by the first command):
Test results:
Checklist
Signed-off-bytrailer matching its author and certifying the DCO.scripts/code_format.sh.AI Assistance Disclosure
AGENTS.md.