Repository navigation
feat(orchestrator): Scale Volume ReadDir Concurrency with Directory Size - #3817
Open
Merlin0220 wants to merge 4 commits into
Open
Merlin0220 wants to merge 4 commits into
Merlin0220 wants to merge 4 commits into
Conversation
…dDir Per-entry stats in ReadDir were serial, making every directory listing cost one storage round trip per entry. Run them on a bounded errgroup instead, with the parallelism configurable through VOLUME_READ_DIR_CONCURRENCY (default 8). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ount A fixed worker pool paid goroutine churn on small listings and capped large ones too early. The parallelism of the per-entry stats is now a function of the listed directory's size: serial below VOLUME_READ_DIR_CONCURRENCY_THRESHOLD, then VOLUME_READ_DIR_CONCURRENCY_BASE workers plus one more per VOLUME_READ_DIR_CONCURRENCY_STEP additional entries, capped at VOLUME_READ_DIR_CONCURRENCY_MAX (5000/4/10000/16 by default). These replace the unreleased VOLUME_READ_DIR_CONCURRENCY knob. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merlin0220
requested review from
ValentaTomas,
dobrac and
jakubno
as code owners
November 12, 2026 06:25
…5000/16 A 5000-entry threshold left the worst serial listing at 5000 storage round trips (~1.5s of in-region NFS RTT) to save microseconds of goroutine scheduling; 1000 keeps that below ~300ms. Base 8 takes the cheap serial-to-parallel win, and a 5000-entry step tracks realistic per-directory sizes (1k-50k) instead of reaching the 16 cap only at 125000 entries. The cap stays 16: past it the per-worker latency gain is marginal while per-listing outstanding requests, which multiply across concurrent listings of one volume, keep growing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This branch has not been deployed
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
Optimize large volume directory listings by fetching per-entry metadata concurrently, with concurrency scaled by the number of entries and bounded by a configurable limit.
This targets network storage such as NFS, where serial metadata lookups can accumulate significant latency. Small directories continue to use serial lookups to avoid concurrency overhead.
Changes
Adaptive concurrency
Introduce
ReadDirScalingto determine concurrency for each directory listing. By default:Use
errgroup.SetLimitto bound concurrent metadata lookups.Configurable scaling
Add Orchestrator configuration and pass it through
Builderto eachChrootedfilesystem instance.Reject invalid configuration during parsing: the threshold must be nonnegative, the base and step must be positive, and the maximum must be at least the base.
Preserve listing behavior
Write metadata results into their corresponding sorted entry positions, preserving name-sorted output regardless of lookup completion order.
Existing behavior is preserved:
Tests
Add unit tests covering:
Tests and performance benchmarks were not run while preparing this description.