Repository navigation
perf: replace flume with lock-free SPSC spin channel - #2349
Merged
Merged
Conversation
Replace flume channels with a custom SPSC (single-producer, single-consumer) channel backed by crossbeam_queue::ArrayQueue and AtomicBool disconnection flags. Uses spin_loop() for waiting instead of thread::park/unpark, eliminating all futex syscalls from the network→disk thread pipeline. Also eliminates redundant zero-initialization in read_payload_into() by using unsafe set_len() instead of resize(len, 0) before the read loop overwrites the same memory. Results (10K files, 422MB, daemon loopback): - futex: 47,000 → 3 (99.99% reduction) - Total syscalls: 136K → 88K (35% reduction) - Initial copy: 1.69x faster than upstream rsync - Incremental: 1.84x faster than upstream rsync
oferchen
added a commit
that referenced
this pull request
May 1, 2026
perf: replace flume with lock-free SPSC spin channel
oferchen
added a commit
that referenced
this pull request
May 5, 2026
perf: replace flume with lock-free SPSC spin channel
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Add a criterion benchmark that sweeps the four SpillPolicy cells (compression None vs Zstd-3, granularity WholeBatch vs PerItem) against a forced-spill workload of 1000 mixed DeltaResult payloads, plus a real SpillableReorderBuffer baseline with a 16 KiB threshold. Each cell prints its simulated bytes-on-disk alongside the criterion timing so default tuning has a side-by-side wall-clock + space view. The bench is cfg(unix) and gated behind the existing spill-compression feature, so default builds stay free of the zstd dev dependency.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Add a criterion benchmark that sweeps the four SpillPolicy cells (compression None vs Zstd-3, granularity WholeBatch vs PerItem) against a forced-spill workload of 1000 mixed DeltaResult payloads, plus a real SpillableReorderBuffer baseline with a 16 KiB threshold. Each cell prints its simulated bytes-on-disk alongside the criterion timing so default tuning has a side-by-side wall-clock + space view. The bench is cfg(unix) and gated behind the existing spill-compression feature, so default builds stay free of the zstd dev dependency.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
* bench(engine): SpillPolicy compression/granularity perf (#2349) Add a criterion benchmark that sweeps the four SpillPolicy cells (compression None vs Zstd-3, granularity WholeBatch vs PerItem) against a forced-spill workload of 1000 mixed DeltaResult payloads, plus a real SpillableReorderBuffer baseline with a 16 KiB threshold. Each cell prints its simulated bytes-on-disk alongside the criterion timing so default tuning has a side-by-side wall-clock + space view. The bench is cfg(unix) and gated behind the existing spill-compression feature, so default builds stay free of the zstd dev dependency. * chore: refresh Cargo.lock
oferchen
added a commit
that referenced
this pull request
May 18, 2026
* bench(engine): SpillPolicy compression/granularity perf (#2349) Add a criterion benchmark that sweeps the four SpillPolicy cells (compression None vs Zstd-3, granularity WholeBatch vs PerItem) against a forced-spill workload of 1000 mixed DeltaResult payloads, plus a real SpillableReorderBuffer baseline with a 16 KiB threshold. Each cell prints its simulated bytes-on-disk alongside the criterion timing so default tuning has a side-by-side wall-clock + space view. The bench is cfg(unix) and gated behind the existing spill-compression feature, so default builds stay free of the zstd dev dependency. * chore: refresh Cargo.lock
oferchen
added a commit
that referenced
this pull request
May 18, 2026
* bench(engine): SpillPolicy compression/granularity perf (#2349) Add a criterion benchmark that sweeps the four SpillPolicy cells (compression None vs Zstd-3, granularity WholeBatch vs PerItem) against a forced-spill workload of 1000 mixed DeltaResult payloads, plus a real SpillableReorderBuffer baseline with a 16 KiB threshold. Each cell prints its simulated bytes-on-disk alongside the criterion timing so default tuning has a side-by-side wall-clock + space view. The bench is cfg(unix) and gated behind the existing spill-compression feature, so default builds stay free of the zstd dev dependency. * chore: refresh Cargo.lock
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
* bench(engine): SpillPolicy compression/granularity perf (#2349) Add a criterion benchmark that sweeps the four SpillPolicy cells (compression None vs Zstd-3, granularity WholeBatch vs PerItem) against a forced-spill workload of 1000 mixed DeltaResult payloads, plus a real SpillableReorderBuffer baseline with a 16 KiB threshold. Each cell prints its simulated bytes-on-disk alongside the criterion timing so default tuning has a side-by-side wall-clock + space view. The bench is cfg(unix) and gated behind the existing spill-compression feature, so default builds stay free of the zstd dev dependency. * chore: refresh Cargo.lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crossbeam_queue::ArrayQueue+AtomicBooldisconnection flags +spin_loop()waiting — zero futex syscallsread_payload_into()(buffer.resize(len, 0)→unsafe set_len()before read overwrites)flumedependency, addcrossbeam-queue(already in Cargo.lock via rayon)Benchmark Results (10K files, 422MB, daemon loopback)
Test plan
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features --no-deps -- -D warningscargo nextest run --workspace --all-features— 21,733 tests pass