Skip to content

bench(transport): SSH sync vs async I/O on slow links (#1889) - #4251

Merged
oferchen merged 1 commit into
masterfrom
bench/ssh-sync-vs-async-1889
May 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
bench/ssh-sync-vs-async-1889

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds crates/rsync_io/benches/ssh_sync_vs_async.rs to compare the current blocking Read + Write SSH transport (SshReader / SshWriter in crates/rsync_io/src/ssh/connection.rs) against a tokio::task::spawn_blocking shim driven from a current_thread runtime. This is the realistic short-term comparison flagged by the Allow workspace brand metadata aliases #1411 and Fix clippy warnings across workspace #1412 evaluations: an embedder integrating oc-rsync into a tokio application would wrap the blocking SSH stdio in spawn_blocking rather than rewrite the transport.
  • The wire is a loopback TcpListener rather than a real sshd so the bench runs unprivileged and identically across Linux, macOS, and Windows CI. The Read + Write cost model on TcpStream matches SshReader / SshWriter on the child's stdio pipes.
  • The slow link is simulated in userspace by a ThrottledRead adapter that sleeps ns_per_byte per read() call. Avoids the kernel-only tc qdisc add dev lo root netem delay 5ms path that benches cannot configure.
  • An optional ssh_binary_smoke cell exercises ssh -V when present and skips with a log line otherwise, so CI without ssh installed does not fail.

Bench cells

  • sync_transfer/1048576, sync_transfer/16777216 - blocking writer thread plus blocking reader on the bench thread, both on the throttled loopback wire.
  • async_spawnblocking_transfer/1048576, async_spawnblocking_transfer/16777216 - the same sync_transfer body invoked via tokio::task::spawn_blocking from a current_thread runtime.
  • ssh_binary_smoke/ssh_-V - skipped when ssh is absent from PATH.

Cargo.toml deltas

  • crates/rsync_io/Cargo.toml: tokio dev-dep now requests rt and io-util in addition to the existing rt-multi-thread, macros, net. Registers the new ssh_sync_vs_async bench with harness = false.

Test plan

  • cargo bench -p rsync_io --bench ssh_sync_vs_async -- --quick on Linux
  • Same on macOS to confirm the loopback wire path works without sshd
  • Same on Windows to confirm cross-platform compilation
  • Confirm the ssh_binary_smoke cell prints the skip notice on a runner without ssh

Adds crates/rsync_io/benches/ssh_sync_vs_async.rs comparing the current
blocking Read+Write SSH transport against a tokio spawn_blocking shim on
a userspace-throttled loopback wire. Sweeps 1 MiB and 16 MiB payloads at
200 ns/byte to simulate a slow link without requiring privileged tc
qdisc netem. The optional ssh-binary smoke cell skips with a clear log
line when ssh is absent on PATH, so CI runners without ssh do not fail.
@oferchen
oferchen merged commit c8c38bc into master May 17, 2026
14 checks passed
oferchen added a commit that referenced this pull request May 18, 2026
Adds crates/rsync_io/benches/ssh_sync_vs_async.rs comparing the current
blocking Read+Write SSH transport against a tokio spawn_blocking shim on
a userspace-throttled loopback wire. Sweeps 1 MiB and 16 MiB payloads at
200 ns/byte to simulate a slow link without requiring privileged tc
qdisc netem. The optional ssh-binary smoke cell skips with a clear log
line when ssh is absent on PATH, so CI runners without ssh do not fail.
oferchen added a commit that referenced this pull request May 18, 2026
Adds crates/rsync_io/benches/ssh_sync_vs_async.rs comparing the current
blocking Read+Write SSH transport against a tokio spawn_blocking shim on
a userspace-throttled loopback wire. Sweeps 1 MiB and 16 MiB payloads at
200 ns/byte to simulate a slow link without requiring privileged tc
qdisc netem. The optional ssh-binary smoke cell skips with a clear log
line when ssh is absent on PATH, so CI runners without ssh do not fail.
@oferchen
oferchen deleted the bench/ssh-sync-vs-async-1889 branch May 19, 2026 19:28
oferchen added a commit that referenced this pull request Aug 24, 2026
Adds crates/rsync_io/benches/ssh_sync_vs_async.rs comparing the current
blocking Read+Write SSH transport against a tokio spawn_blocking shim on
a userspace-throttled loopback wire. Sweeps 1 MiB and 16 MiB payloads at
200 ns/byte to simulate a slow link without requiring privileged tc
qdisc netem. The optional ssh-binary smoke cell skips with a clear log
line when ssh is absent on PATH, so CI runners without ssh do not fail.
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