Allow opt-in command concurrency via environment variables (high-latency storage) - #46
Open
sebclark wants to merge 1 commit into
Open
Allow opt-in command concurrency via environment variables (high-latency storage)#46sebclark wants to merge 1 commit into
sebclark wants to merge 1 commit into
Conversation
Two hardcoded ceilings serialize all disk-bound work: - CommandQueue's disk-access limit function defaults to 1, so every RequiresDiskAccess command runs strictly serially - CommandExecutor's THREAD_LIMIT of 3 caps total command concurrency Both are now configurable via CHAPTARR_DISK_ACCESS_LIMIT and CHAPTARR_COMMAND_THREADS. Defaults are unchanged (1 and 3), so behaviour is identical unless a user opts in. On libraries held on high-latency storage (FUSE/network mounts) the per-file latency dominates and serial scanning is pathological: measured on a large library on a mergerfs/SFTP mount, raising both made metadata operations roughly 5.7x faster.
sebclark
force-pushed
the
opt-in-concurrency
branch
from
August 15, 2026 23:05
796055b to
7266cfd
Compare
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.
Problem
Two hardcoded ceilings serialize all disk-bound work, inherited from Readarr:
CommandQueueManagerconstructsnew CommandQueue()with no limit function, so the disk-access group limit falls back to 1 — everyRequiresDiskAccesscommand runs strictly serially.CommandExecutorhasTHREAD_LIMIT = 3— the hard ceiling on total command concurrency, which silently caps whatever the queue would otherwise allow.On libraries held on high-latency storage (FUSE / network mounts — mergerfs, rclone, NFS are common in this community) per-file latency dominates, and serial scanning is pathological: threads spend nearly all their time blocked on I/O for one file at a time.
Change
Both ceilings become configurable via environment variables:
CHAPTARR_DISK_ACCESS_LIMIT(default 1, unchanged)CHAPTARR_COMMAND_THREADS(default 3, unchanged)Defaults preserve current behaviour exactly — nothing changes unless a user opts in. Doc comments explain the pairing (raising the disk limit alone does nothing without threads to run the extra commands).
Measurements
Large audiobook library (six-figure file count) on a mergerfs-over-SFTP mount: sequential file access measured ~418ms/file; at 8-way it fell to ~67ms effective. Raising both variables to 8 made metadata operations roughly 5.7× faster. We have been running these settings in production for several days across a range of values.
One practical note from that experience: past ~2–3× the host's core count the returns invert on CPU-bound stages, so the docs deliberately frame this as for high-latency storage rather than a general "make it faster" knob.