Repository navigation
mds: add mds_dir_prefetch_backend — non-blocking dirfrag prefetch with configurable lazy trigger - #69832
Conversation
Config Diff Tool Output+ added: mds_dir_prefetch_backend_max (mds.yaml.in)
+ added: mds_dir_prefetch_backend_hit_threshold (mds.yaml.in)
+ added: mds_dir_prefetch_backend (mds.yaml.in)
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
|
/config check ok |
|
Thanks for contributing. You'll need to tick a box in each of the 4 sections of the checklist in the PR description for the second test to pass. |
@anthonyeleven Sure, got it. Thanks very much for your valuable info. I didn't notice this :-) |
The performance gains look nice to me 👍 |
|
jenkins test make check arm64 |
4e7082a to
2a33e86
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
vshankar
left a comment
There was a problem hiding this comment.
Left a minor nit. Otherwise LGTM.
|
This PR has been added to main integration testing by vshankar started 2026-08-05-16:27. |
|
This PR has been added to wip-bharath7-testing-20260824.015917-main. |
|
This PR has been removed from wip-bharath7-testing-20260824.015917-main. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
mds_dir_prefetch_backend bridges the performance gap between mds_dir_prefetch=true (blocking full-omap fetch, ~95 ms for random) and mds_dir_prefetch=false (keyed-only fetch, ~3.7 ms no cache warmth). When mds_dir_prefetch=false and mds_dir_prefetch_backend=true, every dentry lookup completes via a fast targeted keyed OSD fetch while a background full dirfrag prefetch warms the cache for subsequent accesses. mds_dir_prefetch_backend_max (default 1) limits concurrent background fetches to avoid OSD I/O contention. Fixes: https://tracker.ceph.com/issues/77810 Signed-off-by: Xiubo Li <[email protected]>
Defer background dirfrag prefetch until a directory has been hit mds_dir_prefetch_backend_hit_threshold (default 16) times. A per-dir uint8_t hit counter tracks keyed-fetch accesses; only when the counter reaches the threshold is the background full _omap_fetch launched. This avoids wasted full-omap reads for directories that are accessed only a few times in random workloads, while still warming the cache for genuinely hot directories. Threshold 16 effectively eliminates bg fetches on scattered-access patterns (behaving like prefetch_false), while lower thresholds provide more aggressive cache warming for mixed workloads. Also fix a race: clear STATE_FETCHING and STATE_BACKEND_FETCH only on the background fetch completion (complete=true), not on keyed fetch completions that happen to run concurrently. Fixes: https://tracker.ceph.com/issues/77810 Signed-off-by: Xiubo Li <[email protected]>
Signed-off-by: Venky Shankar <[email protected]>
35964aa to
91c0762
Compare
|
@xiubli - the introduced config (prefetch_dirfrag_backend yamls) were not getting picked up in tests. It has to be (sym)linked from the suite directory. I have added a commit to use it in fs:thrash. Tests running here: https://pulpito.ceph.com/vshankar-2026-08-26_08:29:09-fs:thrash-wip-vshankar-testing-20260824.070857-distro-default-trial/ |
LGTM, thanks @vshankar |
|
jenkins test windows |
|
This is good to merge once run wiki is prepared (slight delay due to another PR in the batch having failing tests). |
@dparmar18 Thanks for your feedback. I will leave this to @vshankar since this has already under the tests. Thanks. |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
|
@xiubli @vshankar If these are backported, #69832, #72036 and #72524 need to land in the same point release on each branch. #69832 alone would ship the problems tracked in https://tracker.ceph.com/issues/80828 to anyone running mds_dir_prefetch=false with mds_dir_prefetch_backend=true, and #72524 is the qa change that covers the backend mode. Backports are requested on trackers 77810, 80828 and 81584. |
This PR introduces a fast, non-blocking dirfrag fetch path that serves individual dentry lookups via targeted omap_get_vals_by_keys OSD reads (~4ms) while lazily warming the cache with a background full dirfrag prefetch.
Problem: The default mds_dir_prefetch=true performs a blocking full-omap read on every cache miss, loading all dentries in a dirfrag before returning to the client. For large directories (10k+ files) with random access patterns, this causes ~95ms latency per lookup.
Design:
prefetch=true (existing): blocking full _omap_fetch ~95 ms/stat
prefetch=false (existing): keyed fetch_keys() only ~3.7 ms (no cache warmth)
backend=true (new): keyed fetch + lazy bg full fetch ~3.7–8 ms (adaptive)
When mds_dir_prefetch=false and mds_dir_prefetch_backend=true:
Benchmark results (5000 iters, 10³ dirs × 10k files, 3 OSDs, max=1), latency(ms):
Key observations:
New config options:
Recommended defaults: max=1, hit_threshold=2. For highly random workloads with few repeat hits, increase threshold to 8–16 to eliminate bg fetch overhead entirely.
Fixes: https://tracker.ceph.com/issues/77810
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.