docs(design): adaptive thread-pool sizing replaces static num_cpus*2#3652
Merged
Conversation
Cross-cutting follow-up to PRs #3645 (buffer pool sharding) and #3649 (daemon async accept). Both designs default to num_cpus * 2 which underutilizes I/O-bound workloads and oversubscribes CPU-bound ones. This note specifies a feedback-driven adaptive sizer with a PI-controller in the [60%, 85%] utilization band, hard bounds [max(2, n/2), n*4], 5 s grow / 30 s shrink cadence, and a daemon config knob "transfer-worker-threads = adaptive | <int>" plus an OC_RSYNC_ADAPTIVE_THREADS env-var disable for the first release. Zero wire-protocol impact.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…3652) Cross-cutting follow-up to PRs #3645 (buffer pool sharding) and #3649 (daemon async accept). Both designs default to num_cpus * 2 which underutilizes I/O-bound workloads and oversubscribes CPU-bound ones. This note specifies a feedback-driven adaptive sizer with a PI-controller in the [60%, 85%] utilization band, hard bounds [max(2, n/2), n*4], 5 s grow / 30 s shrink cadence, and a daemon config knob "transfer-worker-threads = adaptive | <int>" plus an OC_RSYNC_ADAPTIVE_THREADS env-var disable for the first release. Zero wire-protocol impact.
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
Cross-cutting design ADR that replaces the static
num_cpus * 2defaults in two recently-landed designs with feedback-driven adaptive sizing.Amends:
docs/design/buffer-pool-sharding.md(PR docs(design): sharded BufferPool layout for high thread counts #3645, merged) - shard count wasnum_cpus * 2.docs/design/daemon-async-accept-sync-workers.md(PR docs(design): daemon async accept loop with sync transfer workers #3649, open) - transfer worker pool wasnum_cpus * 2.The static default underutilizes idle cores on I/O-bound workloads (long-haul SSH, slow disk) and oversubscribes on CPU-bound workloads (compression, checksum). This note specifies a single adaptive sizer both sites can opt into, joining the existing adaptive family alongside the BufferPool capacity resizer (#1640 / #1641) and adaptive queue depth (#1735).
Key sections
[60%, 85%]band (recommended) vs AIMD (rejected as too jittery for long-running transfers).[max(2, num_cpus / 2), num_cpus * 4].OC_RSYNC_ADAPTIVE_THREADS=0env-var disable;transfer-worker-threads = adaptive | <fixed>daemon config knob;BufferPool::with_capacity(Adaptive | Fixed)API.catch_unwind; on panic, pool stays at last-known-good size, no respawn loop.debug_log!line at-vvper sizing decision (mirrors Update oc help banner to use branded daemon wording #1369 SPSC contention metrics pattern).Wire-compat invariants
Zero impact. Pool sizing is process-internal. The sizer does not change the rsync wire protocol, multiplex framing, daemon greeting, auth handshake, file-list / delta / end-of-transfer envelopes, or any frame's byte count, byte order, or padding. Same invariant the two parent designs already establish.
Test plan
crates/engine/src/local_copy/buffer_pool/andcrates/daemon/src/daemon/.