Skip to content

bench(fast_io): NVMe data path stdlib vs io_uring (#2364) - #4381

Merged
oferchen merged 1 commit into
masterfrom
bench/iud-nvme-data-path
May 18, 2026
Merged

oferchen merged 1 commit into
masterfrom
bench/iud-nvme-data-path

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Adds a Linux-only Criterion bench that quantifies the headroom the iouring-data-writes cutover (docs/design/iouring-receive-data-path.md) would close on a real NVMe mount. Companion to the IUD-1 audit confirming most receive data already flows through io_uring; this bench measures what is left.

Two cells, same 10 x 1 GiB workload:

  • stdlib_write: today's Writer::Buffered fallback. BufWriter with the production 256 KiB capacity, one 1 MiB write_all per chunk, flush + sync_all at end-of-file.
  • iouring_write_fixed: the proposed production path for files >= 1 MiB. IORING_OP_WRITE_FIXED against a four-slot registered-buffer pool of 1 MiB page-aligned buffers, followed by IORING_OP_FSYNC matching IoUringDiskBatch::commit_file(do_fsync = true).

Both cells write the same total bytes and run the same fsync cadence so the wall-time / MiB/s delta is attributable strictly to dispatch style.

Gating

  • OC_RSYNC_BENCH_NVME_DATA_PATH=1 to opt in (each iter writes 10 GiB).
  • OC_RSYNC_BENCH_NVME_PATH=/mnt/nvme/scratch optional, pins the scratch dir to a real NVMe mount. Falls back to default TempDir (typically ramdisk on CI) so the bench still produces a ring-lifecycle / submission-cost number when no NVMe is available.
  • cfg(all(target_os = "linux", feature = "io_uring")); macOS / Windows / feature-off builds compile to a stub main that prints a skip line.
  • perf stat invocation documented in the module doc; not wired into the bench so Criterion's wall-time and throughput reporting stays clean.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy -p fast_io --all-targets --all-features --no-deps -- -D warnings
  • cargo bench -p fast_io --bench nvme_data_path on a non-Linux host -> skip line, exit 0
  • cargo bench -p fast_io --bench nvme_data_path --no-default-features -> skip line, exit 0
  • OC_RSYNC_BENCH_NVME_DATA_PATH=1 cargo bench -p fast_io --bench nvme_data_path on Linux 5.6+ -> two cells report bytes/sec

Add a Linux-only Criterion bench that quantifies the headroom the
iouring-data-writes cutover would close on a real NVMe mount. Two
cells exercise the same 10 x 1 GiB workload through the production
write paths:

- stdlib_write: today's Writer::Buffered fallback (BufWriter, 256 KiB,
  one flush + sync_all at end-of-file).
- iouring_write_fixed: IORING_OP_WRITE_FIXED against a four-slot
  registered-buffer pool of 1 MiB page-aligned buffers, followed by
  IORING_OP_FSYNC, matching the production
  IoUringDiskBatch::commit_file placement.

Gated by OC_RSYNC_BENCH_NVME_DATA_PATH=1 because each iteration
writes 10 GiB to disk. OC_RSYNC_BENCH_NVME_PATH optionally pins the
scratch dir to a real NVMe mount; falls back to the default TempDir
location (typically a ramdisk on CI) so the bench still produces a
ring-lifecycle and submission-cost number when no NVMe is available.

The bench is cfg-gated on target_os = "linux" + feature = "io_uring";
macOS, Windows, and feature-off builds compile to a stub main that
prints a skip line. perf stat instructions are documented in the
module doc rather than wired into the bench so Criterion's wall-time
and throughput reporting stays clean.
@oferchen
oferchen force-pushed the bench/iud-nvme-data-path branch from 468ed70 to fb5f4bc Compare May 18, 2026 00:58
@oferchen
oferchen merged commit 365cbef into master May 18, 2026
5 of 16 checks passed
oferchen added a commit that referenced this pull request May 18, 2026
Add a Linux-only Criterion bench that quantifies the headroom the
iouring-data-writes cutover would close on a real NVMe mount. Two
cells exercise the same 10 x 1 GiB workload through the production
write paths:

- stdlib_write: today's Writer::Buffered fallback (BufWriter, 256 KiB,
  one flush + sync_all at end-of-file).
- iouring_write_fixed: IORING_OP_WRITE_FIXED against a four-slot
  registered-buffer pool of 1 MiB page-aligned buffers, followed by
  IORING_OP_FSYNC, matching the production
  IoUringDiskBatch::commit_file placement.

Gated by OC_RSYNC_BENCH_NVME_DATA_PATH=1 because each iteration
writes 10 GiB to disk. OC_RSYNC_BENCH_NVME_PATH optionally pins the
scratch dir to a real NVMe mount; falls back to the default TempDir
location (typically a ramdisk on CI) so the bench still produces a
ring-lifecycle and submission-cost number when no NVMe is available.

The bench is cfg-gated on target_os = "linux" + feature = "io_uring";
macOS, Windows, and feature-off builds compile to a stub main that
prints a skip line. perf stat instructions are documented in the
module doc rather than wired into the bench so Criterion's wall-time
and throughput reporting stays clean.
oferchen added a commit that referenced this pull request May 18, 2026
Add a Linux-only Criterion bench that quantifies the headroom the
iouring-data-writes cutover would close on a real NVMe mount. Two
cells exercise the same 10 x 1 GiB workload through the production
write paths:

- stdlib_write: today's Writer::Buffered fallback (BufWriter, 256 KiB,
  one flush + sync_all at end-of-file).
- iouring_write_fixed: IORING_OP_WRITE_FIXED against a four-slot
  registered-buffer pool of 1 MiB page-aligned buffers, followed by
  IORING_OP_FSYNC, matching the production
  IoUringDiskBatch::commit_file placement.

Gated by OC_RSYNC_BENCH_NVME_DATA_PATH=1 because each iteration
writes 10 GiB to disk. OC_RSYNC_BENCH_NVME_PATH optionally pins the
scratch dir to a real NVMe mount; falls back to the default TempDir
location (typically a ramdisk on CI) so the bench still produces a
ring-lifecycle and submission-cost number when no NVMe is available.

The bench is cfg-gated on target_os = "linux" + feature = "io_uring";
macOS, Windows, and feature-off builds compile to a stub main that
prints a skip line. perf stat instructions are documented in the
module doc rather than wired into the bench so Criterion's wall-time
and throughput reporting stays clean.
@oferchen
oferchen deleted the bench/iud-nvme-data-path branch May 19, 2026 15:12
oferchen added a commit that referenced this pull request Aug 24, 2026
Add a Linux-only Criterion bench that quantifies the headroom the
iouring-data-writes cutover would close on a real NVMe mount. Two
cells exercise the same 10 x 1 GiB workload through the production
write paths:

- stdlib_write: today's Writer::Buffered fallback (BufWriter, 256 KiB,
  one flush + sync_all at end-of-file).
- iouring_write_fixed: IORING_OP_WRITE_FIXED against a four-slot
  registered-buffer pool of 1 MiB page-aligned buffers, followed by
  IORING_OP_FSYNC, matching the production
  IoUringDiskBatch::commit_file placement.

Gated by OC_RSYNC_BENCH_NVME_DATA_PATH=1 because each iteration
writes 10 GiB to disk. OC_RSYNC_BENCH_NVME_PATH optionally pins the
scratch dir to a real NVMe mount; falls back to the default TempDir
location (typically a ramdisk on CI) so the bench still produces a
ring-lifecycle and submission-cost number when no NVMe is available.

The bench is cfg-gated on target_os = "linux" + feature = "io_uring";
macOS, Windows, and feature-off builds compile to a stub main that
prints a skip line. perf stat instructions are documented in the
module doc rather than wired into the bench so Criterion's wall-time
and throughput reporting stays clean.
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.

1 participant