Repository navigation
docs(audits): apply_chunk_parallel call sites and per-chunk dispatch benefit (RJN-1) - #4656
Merged
Merged
Conversation
…benefit (RJN-1) Catalogues every workspace caller of `apply_chunk_parallel` and `apply_batch_parallel`, confirms there are zero non-test, non-bench production call sites today, and traces why the per-chunk path's no-op `rayon::join` second closure does not currently impact real traffic. Concludes with a recommendation for RJN-2: rename to `apply_one_chunk` (or similar) and defer fan-out refactoring to the receiver-wiring work in RJN-3. Also notes that the BR-3i.f cores-vs-throughput bench harness uses `apply_batch_parallel` exclusively, so it will over-state the per-chunk path's scaling if the receiver pipeline ships against the per-chunk entry point. Extending the harness with a per-chunk cell is deferred to RJN-4. Read-only research; no code changes.
oferchen
force-pushed
the
docs/audits/rjn-1-apply-chunk-parallel-sites
branch
from
May 21, 2026 08:28
27e3ab7 to
9bcee5a
Compare
4 tasks done
oferchen
added a commit
that referenced
this pull request
May 21, 2026
…-2) (#4660) Per RJN-1 audit (PR #4656): the name `apply_chunk_parallel` was misleading. The function uses `rayon::join(verify, || ())` with a no-op second closure - it schedules a single chunk's verify on a rayon worker but does NOT parallelize across chunks. The actual multi-chunk parallelism lives in `apply_batch_parallel` via `chunks.into_par_iter()`. Rename to `apply_one_chunk` to reflect actual semantics. Update all 17 call sites (per RJN-1: 1 definition + 12 unit tests in parallel_apply.rs + 2 stress tests in parallel_apply_concurrent.rs + 1 drop-ordering test in arc_drain_panic_recovery.rs + 1 test in chunk_builder.rs). Add rustdoc paragraph clarifying that it is a single-chunk scheduling primitive, not cross-chunk parallelism, and direct callers wanting multi-chunk parallel verify to `apply_batch_parallel(Vec<DeltaChunk>)`. RJN-3 (batched fan-out at the receiver) deferred until receiver wiring exists - currently zero production callers per audit. No semantic code changes. Pure rename + rustdoc edit.
1 task
This was referenced May 21, 2026
oferchen
added a commit
that referenced
this pull request
May 21, 2026
…-2 rename (#4676) RJN-2 (PR #4660, merged) chose the rename path over the fanout-refactor path, discharging the RJN-1 audit (PR #4656, merged) with apply_chunk_parallel -> apply_one_chunk plus a rustdoc redirect to apply_batch_parallel. RJN-3 (implement fanout) and RJN-4 (bench scheduler shape) were the "if RJN-2 chose refactor" branch that did not get taken; this doc closes both. - RJN-3 stays closed: zero production callers of apply_one_chunk; the real multi-chunk win sits in apply_batch_parallel, where ABW-1 (PR #4670) already recommended deferring per its quantified 1.03x-1.50x speedup range; the ABW-2/3/4 closure doc defers that track pending BR-3j.f (#2508) bench data. - RJN-4 is N/A: with RJN-3 deferred there is no "after" cell to measure; the production-weighted scheduler-shape bench effort belongs in parallel_receive_delta_perf via BR-3j.f, not at the per-chunk entry point. - Re-open conditions: a production caller of apply_one_chunk ships AND profiling shows the per-chunk path is hot. Project memory references project_rayon_join_per_chunk_noop.md and project_apply_batch_write_serial.md - both observations remain accurate under the renamed function.
This was referenced May 21, 2026
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…benefit (RJN-1) (#4656) Catalogues every workspace caller of `apply_chunk_parallel` and `apply_batch_parallel`, confirms there are zero non-test, non-bench production call sites today, and traces why the per-chunk path's no-op `rayon::join` second closure does not currently impact real traffic. Concludes with a recommendation for RJN-2: rename to `apply_one_chunk` (or similar) and defer fan-out refactoring to the receiver-wiring work in RJN-3. Also notes that the BR-3i.f cores-vs-throughput bench harness uses `apply_batch_parallel` exclusively, so it will over-state the per-chunk path's scaling if the receiver pipeline ships against the per-chunk entry point. Extending the harness with a per-chunk cell is deferred to RJN-4. Read-only research; no code changes.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…-2) (#4660) Per RJN-1 audit (PR #4656): the name `apply_chunk_parallel` was misleading. The function uses `rayon::join(verify, || ())` with a no-op second closure - it schedules a single chunk's verify on a rayon worker but does NOT parallelize across chunks. The actual multi-chunk parallelism lives in `apply_batch_parallel` via `chunks.into_par_iter()`. Rename to `apply_one_chunk` to reflect actual semantics. Update all 17 call sites (per RJN-1: 1 definition + 12 unit tests in parallel_apply.rs + 2 stress tests in parallel_apply_concurrent.rs + 1 drop-ordering test in arc_drain_panic_recovery.rs + 1 test in chunk_builder.rs). Add rustdoc paragraph clarifying that it is a single-chunk scheduling primitive, not cross-chunk parallelism, and direct callers wanting multi-chunk parallel verify to `apply_batch_parallel(Vec<DeltaChunk>)`. RJN-3 (batched fan-out at the receiver) deferred until receiver wiring exists - currently zero production callers per audit. No semantic code changes. Pure rename + rustdoc edit.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…-2 rename (#4676) RJN-2 (PR #4660, merged) chose the rename path over the fanout-refactor path, discharging the RJN-1 audit (PR #4656, merged) with apply_chunk_parallel -> apply_one_chunk plus a rustdoc redirect to apply_batch_parallel. RJN-3 (implement fanout) and RJN-4 (bench scheduler shape) were the "if RJN-2 chose refactor" branch that did not get taken; this doc closes both. - RJN-3 stays closed: zero production callers of apply_one_chunk; the real multi-chunk win sits in apply_batch_parallel, where ABW-1 (PR #4670) already recommended deferring per its quantified 1.03x-1.50x speedup range; the ABW-2/3/4 closure doc defers that track pending BR-3j.f (#2508) bench data. - RJN-4 is N/A: with RJN-3 deferred there is no "after" cell to measure; the production-weighted scheduler-shape bench effort belongs in parallel_receive_delta_perf via BR-3j.f, not at the per-chunk entry point. - Re-open conditions: a production caller of apply_one_chunk ships AND profiling shows the per-chunk path is hot. Project memory references project_rayon_join_per_chunk_noop.md and project_apply_batch_write_serial.md - both observations remain accurate under the renamed function.
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
ParallelDeltaApplier::apply_chunk_parallel(crates/engine/src/concurrent_delta/parallel_apply.rs:468) andapply_batch_parallel(:499) and tabulates each site's shape, throughput estimate, and parallelism benefit.SequentialDeltaPipeline/ParallelDeltaPipelineflow speaksDeltaWorkthroughDeltaConsumerand never touchesParallelDeltaApplier. BR-3i.d'sChunkBuilderhas no production callers either. Every existing call to the per-chunk path is a test exercising the typed-error surface, a DashMap shard-contention probe, or a drop-ordering race.rayon::join(verify, || ())second-closure no-op flagged inproject_rayon_join_per_chunk_noop.mdis therefore a naming issue today, not a performance issue.Recommendation for RJN-2
Rename, do not refactor. Suggested target:
apply_one_chunk(parallel withapply_batch). Justifications:DeltaConsumerreorder buffer.Bench cross-reference
Both bench harnesses (
crates/engine/benches/parallel_receive_delta_perf.rs:263and the BR-3i.f harnesscrates/engine/benches/parallel_verify_chunk.rs:206on branchperf/engine-parallel-verify-chunk-bench-br3if, commit9a4b97f53) driveapply_batch_parallelexclusively. If the receiver ever ships against the per-chunk path, the bench results will over-state achievable scaling. Extending the harness to add a per-chunk cell is deferred to RJN-4.Test plan
git statusclean after commit.docs/audits/rjn-1-apply-chunk-parallel-call-sites-2026-05-21.md.