[TransferEngine] Add instant bandwidth reporting to tebench - #3358
[TransferEngine] Add instant bandwidth reporting to tebench#3358alogfans wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
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.
Adds instant per-transfer bandwidth reporting to tebench, including a new pacing flag and updated benchmark output so latency can be derived from the same measurement basis as instant bandwidth.
Changes:
- Added
--request_interval_usflag and plumbing inXferBenchConfigto pace transfer batch issuance. - Collected per-transfer “instant bandwidth” and added
Avg Inst GB/sto the benchmark table output. - Derived
Avg Lat (us)fromAvg Inst GB/s(instead of total-duration-based latency).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| mooncake-transfer-engine/benchmark/utils.h | Adds config field for request pacing and a new stats channel for instant bandwidth. |
| mooncake-transfer-engine/benchmark/utils.cpp | Adds the new flag, wires it into config, and extends output table + latency derivation. |
| mooncake-transfer-engine/benchmark/main.cpp | Implements per-transfer instant bandwidth sampling and request pacing via busy-wait/yield. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
711ff89 to
48cd741
Compare
48cd741 to
18e5bcc
Compare
| (total_duration / 1e6)); // In GB/Sec | ||
| const double avg_instant_gbps = stats.instant_bandwidth.avg(); | ||
| if (avg_instant_gbps > 0.0) { | ||
| avg_latency = static_cast<double>(block_size * batch_size) / |
There was a problem hiding this comment.
Avg Lat (us) is now near-duplicate of Avg Tx (us) and silently changes semantics
Avg Tx (us) is already stats.transfer_duration.avg() — the arithmetic mean of per-transfer duration. The new Avg Lat (us) (when avg_instant_gbps > 0) simplifies to 1 / mean(1/duration_i) — the harmonic mean of the same per-transfer durations. By Jensen's inequality (1/x is convex), harmonic <= arithmetic, with equality only when all durations are identical. In my local run (1MB, 2 threads, no pacing) the two columns read 1539.9 vs 1540.2 us — within noise, so the new column adds no information beyond Avg Tx (us).
Beyond redundancy, this silently alters the semantics of Avg Lat (us):
- Old:
total_duration * num_threads / num_ops— wall-clock per-op, includes pacing / scheduling gaps between transfers. - New:
1 / mean(1/duration_i)— per-transfer duration only, excludes gaps.
When --request_interval_us is set, the old metric would have reported transfer time + pacing gap, while the new one reports only transfer time. Existing users who rely on Avg Lat (us) as a wall-clock per-op figure will be misled, and the PR description doesn't flag this change.
Suggestion: Since Avg Tx (us) already covers per-transfer latency, the minimal change is to keep Avg Lat (us) at its old wall-clock semantics and let Avg Inst GB/s be the sole new column. Alternatively, if per-transfer latency is the intended meaning, drop Avg Lat (us) and relabel Avg Tx (us) — but that's a bigger break.
Description
This PR adds instant bandwidth reporting to
tebench.Changes include:
--request_interval_usto optionally pace issued transfer batches.GB/s.Avg Inst GB/sto the regular benchmark output table.Avg Lat (us)fromAvg Inst GB/s, keeping latency and instant bandwidth on the same measurement basis.The pacing implementation uses
std::this_thread::yield()for busy-waiting and does not introduce mutexes in the request pacing path.Module
mooncake-transfer-engine)mooncake-store)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Test commands:
Test results:
Checklist
./scripts/code_format.shpre-commit run --all-filesand all hooks passAI Assistance Disclosure
Codex was used to help implement and refine the benchmark reporting changes and prepare this PR description.