Skip to content

bench(fast_io): io_uring per-file vs shared ring on 100K small files (#1410) - #4197

Merged
oferchen merged 2 commits into
masterfrom
bench/iouring-per-file-vs-shared-1410
May 17, 2026
Merged

oferchen merged 2 commits into
masterfrom
bench/iouring-per-file-vs-shared-1410

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds crates/fast_io/benches/iouring_per_file_vs_shared.rs, a Criterion bench that synthesises the two ring lifecycles called out in docs/audits/per-file-vs-shared-uring-ring.md (task Add xtask branding command and correct CI CLI test target #1410): the current per-file ring (one io_uring_setup(2) per output file) and a long-lived shared ring that re-registers each new fd into the same fixed-file table.
  • Writes 100,000 4 KiB files per topology and reports throughput in elements/sec so the two rows compare directly.
  • Linux-only at compile time (target_os = "linux", with a stub main on macOS / Windows). Registered in Cargo.toml with required-features = ["io_uring"] and gated at runtime by OC_RSYNC_BENCH_IOURING_RING=1 so casual cargo bench runs do not pick up multi-minute work.
  • Pure bench: no production changes to fast_io. The per-file prototype lives entirely inside the bench file with documented SAFETY comments on each unsafe block.

What the numbers inform

Outcome -> action on task #2243 (shared-ring priority):

How to run

Requires an unprivileged container or bare-metal Linux 5.6+ with io_uring_setup(2) reachable (GitHub-hosted Windows / macOS runners cannot execute it):

OC_RSYNC_BENCH_IOURING_RING=1 \
  cargo bench -p fast_io --bench iouring_per_file_vs_shared

Without the env var, the bench prints a skip line and exits 0.

Test plan

  • CI fmt + clippy green on Linux, macOS, Windows (compile-only check that the cfg gating works).
  • CI nextest green (no test impact; bench files are not test targets).
  • Manual run on a Linux 5.6+ host with OC_RSYNC_BENCH_IOURING_RING=1 confirms both per_file_ring and shared_ring rows produce elements/sec measurements.
  • Manual run with the env var unset confirms the skip messages print and the bench exits 0.

oferchen added 2 commits May 17, 2026 06:43
Adds a Criterion bench that synthesises the two ring lifecycles called
out in docs/audits/per-file-vs-shared-uring-ring.md (#1410): the current
per-file ring (one io_uring_setup per output file) and a long-lived
shared ring that re-registers each new fd into the same fixed-file
table. Each topology writes 100,000 4 KiB files and reports throughput
in elements/second so the rows compare directly.

The bench is Linux-only (gated by target_os = "linux" with a stub main
for macOS / Windows), requires the io_uring feature, and is gated by
the OC_RSYNC_BENCH_IOURING_RING=1 env var so casual cargo bench runs
do not pick up multi-minute work. It skips cleanly when io_uring_setup
is blocked by the kernel or container runtime.
@oferchen
oferchen force-pushed the bench/iouring-per-file-vs-shared-1410 branch from 8f914b7 to 241293a Compare May 17, 2026 03:43
@oferchen
oferchen merged commit ee0b26d into master May 17, 2026
40 checks passed
@oferchen
oferchen deleted the bench/iouring-per-file-vs-shared-1410 branch May 17, 2026 04:29
oferchen added a commit that referenced this pull request May 17, 2026
…4220)

Document the trade-offs for pushing io_uring SQEs from rayon worker
threads. Records current submission topology, per-worker hazards,
the single-submitter alternative, missing bench evidence, and a
recommendation to defer until #2243 (per-thread rings) and #4197
(per-file vs shared ring bench) converge.
oferchen added a commit that referenced this pull request May 18, 2026
…1410) (#4197)

* bench(fast_io): io_uring per-file vs shared ring on 100K small files

Adds a Criterion bench that synthesises the two ring lifecycles called
out in docs/audits/per-file-vs-shared-uring-ring.md (#1410): the current
per-file ring (one io_uring_setup per output file) and a long-lived
shared ring that re-registers each new fd into the same fixed-file
table. Each topology writes 100,000 4 KiB files and reports throughput
in elements/second so the rows compare directly.

The bench is Linux-only (gated by target_os = "linux" with a stub main
for macOS / Windows), requires the io_uring feature, and is gated by
the OC_RSYNC_BENCH_IOURING_RING=1 env var so casual cargo bench runs
do not pick up multi-minute work. It skips cleanly when io_uring_setup
is blocked by the kernel or container runtime.

* style(fast_io): apply rustfmt to iouring_per_file_vs_shared bench
oferchen added a commit that referenced this pull request May 18, 2026
…4220)

Document the trade-offs for pushing io_uring SQEs from rayon worker
threads. Records current submission topology, per-worker hazards,
the single-submitter alternative, missing bench evidence, and a
recommendation to defer until #2243 (per-thread rings) and #4197
(per-file vs shared ring bench) converge.
oferchen added a commit that referenced this pull request May 18, 2026
…1410) (#4197)

* bench(fast_io): io_uring per-file vs shared ring on 100K small files

Adds a Criterion bench that synthesises the two ring lifecycles called
out in docs/audits/per-file-vs-shared-uring-ring.md (#1410): the current
per-file ring (one io_uring_setup per output file) and a long-lived
shared ring that re-registers each new fd into the same fixed-file
table. Each topology writes 100,000 4 KiB files and reports throughput
in elements/second so the rows compare directly.

The bench is Linux-only (gated by target_os = "linux" with a stub main
for macOS / Windows), requires the io_uring feature, and is gated by
the OC_RSYNC_BENCH_IOURING_RING=1 env var so casual cargo bench runs
do not pick up multi-minute work. It skips cleanly when io_uring_setup
is blocked by the kernel or container runtime.

* style(fast_io): apply rustfmt to iouring_per_file_vs_shared bench
oferchen added a commit that referenced this pull request May 18, 2026
…4220)

Document the trade-offs for pushing io_uring SQEs from rayon worker
threads. Records current submission topology, per-worker hazards,
the single-submitter alternative, missing bench evidence, and a
recommendation to defer until #2243 (per-thread rings) and #4197
(per-file vs shared ring bench) converge.
oferchen added a commit that referenced this pull request Aug 24, 2026
…1410) (#4197)

* bench(fast_io): io_uring per-file vs shared ring on 100K small files

Adds a Criterion bench that synthesises the two ring lifecycles called
out in docs/audits/per-file-vs-shared-uring-ring.md (#1410): the current
per-file ring (one io_uring_setup per output file) and a long-lived
shared ring that re-registers each new fd into the same fixed-file
table. Each topology writes 100,000 4 KiB files and reports throughput
in elements/second so the rows compare directly.

The bench is Linux-only (gated by target_os = "linux" with a stub main
for macOS / Windows), requires the io_uring feature, and is gated by
the OC_RSYNC_BENCH_IOURING_RING=1 env var so casual cargo bench runs
do not pick up multi-minute work. It skips cleanly when io_uring_setup
is blocked by the kernel or container runtime.

* style(fast_io): apply rustfmt to iouring_per_file_vs_shared bench
oferchen added a commit that referenced this pull request Aug 24, 2026
…4220)

Document the trade-offs for pushing io_uring SQEs from rayon worker
threads. Records current submission topology, per-worker hazards,
the single-submitter alternative, missing bench evidence, and a
recommendation to defer until #2243 (per-thread rings) and #4197
(per-file vs shared ring bench) converge.
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