Skip to content

os/bluestore: Fix problem with onode cache causing stalls - #65792

Merged
Jayaprakash-ibm merged 3 commits into
ceph:mainfrom
aclamk:aclamk-bs-onode-stall-fix
Jun 9, 2026
Merged

Jayaprakash-ibm merged 3 commits into
ceph:mainfrom
aclamk:aclamk-bs-onode-stall-fix

Conversation

@aclamk

@aclamk aclamk commented Oct 6, 2025 •

Copy link
Copy Markdown
Contributor

Elements in onode cache shards are evicted when new element is inserted into the cache.
In rare cases of cluster inactivity cache can be reduced, but not evicted.
Adjusting size at once will cause stall first time cache shard is accessed.
The solution is to dampen the effect by evicting only few onodes at a time.

In addition, mempool_thread gets ability to evicts some onodes right after PriorityCache Meta size is changed.

Fixes: https://tracker.ceph.com/issues/73353

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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@github-actions

github-actions Bot commented Oct 6, 2025 •

Copy link
Copy Markdown

Config Diff Tool Output

+ added: bluestore_cache_meta_evict_limit (global.yaml.in)
+ added: bluestore_cache_meta_evict_in_autotune (global.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@aclamk
aclamk requested a review from ifed01 October 7, 2025 13:56
@aclamk

aclamk commented Oct 7, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@@ -2152,7 +2152,7 @@ void BlueStore::OnodeSpace::rename(

o->oid = new_oid;
o->key = new_okey;
cache->_trim();

@ifed01 ifed01 Oct 13, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see cache's _trim() call in BlueStore::BufferSpace::_finish_write() as well, shouldn't we update it too?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there is _trim() call at the end of BlueStore::Collection::split_cache(). Wouldn't it be better to have it at the beginning hence making cache splitting more efficient (as no 'to-be-evicted' entries are processed)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ifed01
Regarding " _trim() in BlueStore::BufferSpace::_finish_write()".
This PR targets onode caching behaviour, so buffer cache is unrelated.

Can we suffer from similar affliction on kv, kv_onode or data caches?
The latency spike was observed on meta due to 2 reasons:

  1. meta tends to be largest
  2. onodes take significant time to destroy

My thinking is that maybe we should modify logic of PriorityCacheManager to not revoke memory allotment from caches if there is no pressure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ifed01
Regarding split_cache().
I removed invoking _trim() completely.

Rationale:

  1. merging: trimming forcibly after merge can cause mini stalls
  2. splitting: trimming forcibly before split can force dropping elements that will fit perfectly after split

Comment thread src/common/options/global.yaml.in Resolved
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Dec 12, 2025
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution!

@github-actions github-actions Bot closed this Jan 11, 2026
@aclamk aclamk reopened this Jan 21, 2026
@github-actions github-actions Bot removed the stale label Jan 21, 2026
@ifed01

ifed01 commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

@aclamk - any plans to revive this PR?

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label May 5, 2026
aclamk added 2 commits May 26, 2026 09:46
Limits how many onodes can be evicted from OnodeCacheShard in one go.
Added bluestore_cache_meta_drop_limit that controls how fast
onodes can be evicted from cache.

Fixes: https://tracker.ceph.com/issues/73353

Signed-off-by: Adam Kupczyk <[email protected]>
Add bluestore_cache_meta_evict_in_autotune configurable.
It allows to evict onodes as part of autotune process.
This makes onode CacheShards size adapt to PriorityCache Meta
memory allocation.

Fixes: https://tracker.ceph.com/issues/73353

Signed-off-by: Adam Kupczyk <[email protected]>
@aclamk aclamk removed the stale label May 26, 2026
There are 2 cases when Collection::split_cache is used:
1) Merge Collections.
   It this case we get more elements in dest collection,
   but we do not want to trim by force as it might cause stall.
2) Split Collection
   Source cache is getting thinner, and dest cache is growing.
   Similarly, trimming dest will cause stall.

Decision:
It is better to not trim forcibly and relay on gradual trimming
from MempoolThread or client IO.

Signed-off-by: Adam Kupczyk <[email protected]>
@aclamk
aclamk force-pushed the aclamk-bs-onode-stall-fix branch from 5296197 to d2f2d86 Compare May 26, 2026 10:44
@Jayaprakash-ibm

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants