Skip to content

docs(audits): static analysis of drain_parallel Mutex contention - #3699

Merged
oferchen merged 1 commit into
masterfrom
docs/drain-parallel-contention-1679
May 5, 2026
Merged

oferchen merged 1 commit into
masterfrom
docs/drain-parallel-contention-1679

Conversation

@oferchen

@oferchen oferchen commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds docs/audits/drain-parallel-contention-static-analysis.md,
    a code-grounded static analysis of drain_parallel Mutex
    contention that addresses task Fix Windows GNU EH shim exports #1679 ahead of runtime profiling.
  • Enumerates every Mutex::lock() site reachable from the result
    collection path with file:line citations, distinguishing hot-path
    (per-result), batched, and shutdown-class acquisitions.
  • Compares three designs (single Mutex<Vec>, per-thread Vec
    with final merge, lock-free MPSC channel) with code-grounded
    evidence for and against each, derives a parameterised contention
    formula at W=8/16/32/64, and recommends deferring Refactor daemon CLI into dedicated module #1681 until
    Fix Windows GNU EH shim exports #1679 has measured the sharded design at W=32 / 64.

Touches docs only. No code changes.

Test plan

  • Audit doc lints clean (no em-dashes, no forbidden references,
    hyphen prose style).
  • All file:line citations point to real lines on the verified
    commit (crates/engine/src/concurrent_delta/work_queue/drain.rs,
    consumer.rs, delta_pipeline.rs, bench harnesses).
  • Doc length is within the 250-450 line target.
  • CI: docs PR; only fmt+clippy and the standard checks should
    run since no Rust source is touched.

Captures the load-bearing facts a runtime profile of #1679 will then
quantify: every Mutex::lock() site reachable from drain_parallel is
enumerated, the per-thread Vec mitigation from #1680 is shown to be
contention-free in steady state, and three alternative designs (single
Mutex, per-thread Vec, lock-free MPSC) are compared with file:line
citations. Recommends deferring #1681 until #1679 measures the sharded
design at W=32 / 64.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 5, 2026
@oferchen
oferchen merged commit 9a9bf24 into master May 5, 2026
8 checks passed
oferchen added a commit that referenced this pull request May 5, 2026
…nalysis (#1192)

Static analysis of every Arc<Mutex<Vec<...>>> remaining in the workspace,
focused on the parallel stat hot path. Confirms parallel stat does not
allocate any shared mutex-guarded accumulator: map_blocking delegates to
rayon's into_par_iter().map().collect() with per-task buffers internal
to rayon. Three production sites remain (SSH stderr drain x2, drain_parallel
shards), only the third is on a rayon hot path and is sharded already.

Cites the just-merged drain-side audit (PR #3699) for the drain-shards
analysis, scopes #1192 to runtime profiling needed for closure, and lists
mitigations to evaluate only if profiling surfaces a residual Mutex<Vec>.
oferchen added a commit that referenced this pull request May 5, 2026
…nalysis (#1192) (#3727)

Static analysis of every Arc<Mutex<Vec<...>>> remaining in the workspace,
focused on the parallel stat hot path. Confirms parallel stat does not
allocate any shared mutex-guarded accumulator: map_blocking delegates to
rayon's into_par_iter().map().collect() with per-task buffers internal
to rayon. Three production sites remain (SSH stderr drain x2, drain_parallel
shards), only the third is on a rayon hot path and is sharded already.

Cites the just-merged drain-side audit (PR #3699) for the drain-shards
analysis, scopes #1192 to runtime profiling needed for closure, and lists
mitigations to evaluate only if profiling surfaces a residual Mutex<Vec>.
@oferchen
oferchen deleted the docs/drain-parallel-contention-1679 branch May 6, 2026 18:57
oferchen added a commit that referenced this pull request May 18, 2026
Captures the load-bearing facts a runtime profile of #1679 will then
quantify: every Mutex::lock() site reachable from drain_parallel is
enumerated, the per-thread Vec mitigation from #1680 is shown to be
contention-free in steady state, and three alternative designs (single
Mutex, per-thread Vec, lock-free MPSC) are compared with file:line
citations. Recommends deferring #1681 until #1679 measures the sharded
design at W=32 / 64.
oferchen added a commit that referenced this pull request May 18, 2026
…nalysis (#1192) (#3727)

Static analysis of every Arc<Mutex<Vec<...>>> remaining in the workspace,
focused on the parallel stat hot path. Confirms parallel stat does not
allocate any shared mutex-guarded accumulator: map_blocking delegates to
rayon's into_par_iter().map().collect() with per-task buffers internal
to rayon. Three production sites remain (SSH stderr drain x2, drain_parallel
shards), only the third is on a rayon hot path and is sharded already.

Cites the just-merged drain-side audit (PR #3699) for the drain-shards
analysis, scopes #1192 to runtime profiling needed for closure, and lists
mitigations to evaluate only if profiling surfaces a residual Mutex<Vec>.
oferchen added a commit that referenced this pull request Aug 24, 2026
Captures the load-bearing facts a runtime profile of #1679 will then
quantify: every Mutex::lock() site reachable from drain_parallel is
enumerated, the per-thread Vec mitigation from #1680 is shown to be
contention-free in steady state, and three alternative designs (single
Mutex, per-thread Vec, lock-free MPSC) are compared with file:line
citations. Recommends deferring #1681 until #1679 measures the sharded
design at W=32 / 64.
oferchen added a commit that referenced this pull request Aug 24, 2026
…nalysis (#1192) (#3727)

Static analysis of every Arc<Mutex<Vec<...>>> remaining in the workspace,
focused on the parallel stat hot path. Confirms parallel stat does not
allocate any shared mutex-guarded accumulator: map_blocking delegates to
rayon's into_par_iter().map().collect() with per-task buffers internal
to rayon. Three production sites remain (SSH stderr drain x2, drain_parallel
shards), only the third is on a rayon hot path and is sharded already.

Cites the just-merged drain-side audit (PR #3699) for the drain-shards
analysis, scopes #1192 to runtime profiling needed for closure, and lists
mitigations to evaluate only if profiling surfaces a residual Mutex<Vec>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant