Skip to content

docs(design): dedicated drain_parallel consumer thread for ReorderBuffer (#1545) - #4231

Merged
oferchen merged 1 commit into
masterfrom
docs/drain-parallel-consumer-1545
May 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
docs/drain-parallel-consumer-1545

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Inventories today's concurrent_delta consumer (two threads: delta-drain runs drain_parallel_into inside rayon::scope; delta-reorder owns the ReorderBuffer and drains a bounded streaming channel; force_insert fallback on consumer.rs:193 breaks deadlocks by silently growing the ring).
  • Proves the ordering contract: drain_parallel_into may reshuffle within a batch, but the producer-stamped sequence on every DeltaResult reassembles the wire order through ReorderBuffer::insert/drain_ready.
  • Sketches a single-thread topology (consumer thread owns rayon::scope and a SPSC ring in place of the bounded channel), discusses backpressure in both directions, and analyses interaction with the force_insert smell (refactor does not remove it; capacity contract change does).
  • Recommends deferring the topology change until the drain_parallel_alternatives bench from bench(engine): drain_parallel alternatives at 10K/100K items (#1682) #4214 lands, and landing the force_insert counter plus drain batch/pause histograms first.

Doc: docs/design/drain-parallel-consumer-thread.md. No code changes.

Test plan

  • Design doc only; no tests required.
  • CI: fmt+clippy passes (doc-only change, no code touched).

Add a design note that inventories the current two-thread
delta-drain/delta-reorder topology, proves the ordering contract is
preserved by the per-result sequence key, sketches the single-thread
alternative, and recommends deferring the refactor until the
drain_parallel_alternatives bench from #4214 lands. Includes proposed
metric additions (force_insert counter, drain batch size and pause
histograms) that should land independently as a prerequisite to any
later capacity-contract work.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 17, 2026
@oferchen
oferchen merged commit de103a9 into master May 17, 2026
8 checks passed
oferchen added a commit that referenced this pull request May 18, 2026
Add a design note that inventories the current two-thread
delta-drain/delta-reorder topology, proves the ordering contract is
preserved by the per-result sequence key, sketches the single-thread
alternative, and recommends deferring the refactor until the
drain_parallel_alternatives bench from #4214 lands. Includes proposed
metric additions (force_insert counter, drain batch size and pause
histograms) that should land independently as a prerequisite to any
later capacity-contract work.
oferchen added a commit that referenced this pull request May 18, 2026
Add a design note that inventories the current two-thread
delta-drain/delta-reorder topology, proves the ordering contract is
preserved by the per-result sequence key, sketches the single-thread
alternative, and recommends deferring the refactor until the
drain_parallel_alternatives bench from #4214 lands. Includes proposed
metric additions (force_insert counter, drain batch size and pause
histograms) that should land independently as a prerequisite to any
later capacity-contract work.
@oferchen
oferchen deleted the docs/drain-parallel-consumer-1545 branch May 19, 2026 19:27
oferchen added a commit that referenced this pull request Aug 24, 2026
Add a design note that inventories the current two-thread
delta-drain/delta-reorder topology, proves the ordering contract is
preserved by the per-result sequence key, sketches the single-thread
alternative, and recommends deferring the refactor until the
drain_parallel_alternatives bench from #4214 lands. Includes proposed
metric additions (force_insert counter, drain batch size and pause
histograms) that should land independently as a prerequisite to any
later capacity-contract work.
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