Skip to content

crimson/os/seastore/epm: make max_generation and gc_formula configurable - #64452

Merged
Matan-B merged 2 commits into
ceph:mainfrom
xxhdx1985126:wip-72087
Jul 30, 2025
Merged

Matan-B merged 2 commits into
ceph:mainfrom
xxhdx1985126:wip-72087

Conversation

@xxhdx1985126

@xxhdx1985126 xxhdx1985126 commented Jul 11, 2025 •

Copy link
Copy Markdown
Member

GREEDY algorithm doesn't have the issue in https://tracker.ceph.com/issues/72087, so we make gc_formula configurable. Meanwhile to enhance the Generational GC, we also make max generation related variables configurable.

This PR also move omap extent types into data types, so omap nodes can also be evicted to the cold tier if it exists.

Signed-off-by: Xuehan Xu [email protected]

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

@xxhdx1985126

xxhdx1985126 commented Jul 12, 2025 •

Copy link
Copy Markdown
Member Author

@cyx1231st Hi, yingxin. After a second thought, it looks to me that the segment reclaim algorithm has the following features:

  1. the purpose of the algorithm is to avoid prequently moving long-lifecycle data, so the segment reclaim process can be more efficient;
  2. by generational gc, we can split the data into different lifecycles in terms of generations
  3. the usage of larger generation segments decrease slower than smaller generation segments

IIUC, since we already split the data by generations and larger generation segments' utilization decrease slower (which means the frequency of the moving of long-lifecycle data is already reduced), we don't have to consider the segments' age/modify_time (which increases the frequency of the reclaim of larger-generation segments) when selecting segments to reclaim, simply selecting less utilized segments (the GREEDY algorithm) should be enough. Am I missing something? If I'm right, we can drop the modify_time of CachedExtent and Segment completely.

@Matan-B Matan-B added this to Crimson Jul 13, 2025
@Matan-B Matan-B moved this to Awaits review in Crimson Jul 13, 2025
@cyx1231st

cyx1231st commented Jul 14, 2025 •

Copy link
Copy Markdown
Member

This isn't a bug fix.

See #46436, it is not an easy decision to modify reclaim policies, we need a complete theory and comprehensive experiments and to understand&prove the overall impacts (including this PR), especially:

  • Are the segments properly group extents with similar coldness? -- frequently-retire and infrequently-retire extents should not be mixed together.
  • Is write amplification from reclaim really reduced after the change, under long-time tests (zipf) ?

"modify_time" is important and necessary information. Generational GC only helps to group similar lifecyle into the same segment, it doesn't provide any information about the actual absolute age of the segment. The reclaim algorithms (GREEDY, COST-BENEFIT, BENEFIT) are based on the absolute age (modify_time) from the original design. I don't think we can drop it.

For GREEDY vs COSY_BENEFIT policy, the previous analysis did show significant differences with regard to reclaim write amplification, which is consistent with the original paper introducing these designs.

@xxhdx1985126

xxhdx1985126 commented Jul 14, 2025 •

Copy link
Copy Markdown
Member Author

This isn't a bug fix.

See #46436, it is not an easy decision to modify reclaim policies, we need a complete theory and comprehensive experiments and to understand&prove the overall impacts (including this PR), especially:

  • Are the segments properly group extents with similar coldness? -- frequently-retire and infrequently-retire extents should not be mixed together.
  • Is write amplification from reclaim really reduced after the change, under long-time tests (zipf) ?

"modify_time" is important and necessary information. Generational GC only helps to group similar lifecyle into the same segment, it doesn't provide any information about the actual absolute age of the segment.
The reclaim algorithms (GREEDY, COST-BENEFIT, BENEFIT) are based on the absolute age (modify_time) from the original design. I don't think we can drop it.

I think, as long as similar lifecycle data are grouped in the same segments, we can already avoid unncessarily moving long-lifecycle data during segment reclaims. We don't need to know the absolute age of the segment.

Looking at the current COST_BENEFIT algorithm:

return (1 - util) * (age_now - age_segment) / (2 * util);

I think the age only helps to reclaim long-lifecycle segments early, even when the util is very high.

I think the performance improvement of COST-BENEFIT compared to GREEDY in #46436 was caused by the low upper bound the MAX_REWRITE_GENERATION which is only 7 at present, which means we can't differentiate the lifecycle of data that has survived more than 7 rewrites and the age is actually helping by serving as an indicator of the lifecycle of the more-than-7-rewrite data. We can try to increase MAX_REWRITE_GENERATION, for example to 100?

What do you think? @cyx1231st

For GREEDY vs COSY_BENEFIT policy, the previous analysis did show significant differences with regard to reclaim write amplification, which is consistent with the original paper introducing these designs.

@cyx1231st

cyx1231st commented Jul 14, 2025 •

Copy link
Copy Markdown
Member

I think for reclaim policy changes, the actual impacts are not obvious as long-term and systematic behavor. We need to define a standard way to do evaluations and use it as an apple-to-apple way to prove that any new policy results in better bimodel utilization distribution, and most importantly, less write amplifications from background reclaim.

Also, different policies may perform differently under various utilization levels, it can be case-by-case.

The classical COSY_BENEFIT was proved to be reasonable, with a good backing theory from paper.

If we can prove ignoring modify-time and increasing generation upperbound is benefitial (even only under certain utilization level), I think the better way is to introduce an independent policy, and make generation-upperbound configurable (with cleanups to make it easier to maintain, as it is currently only statically implemented).

for example to 100?

I think it's not appropriate to guess.

@xxhdx1985126

xxhdx1985126 commented Jul 14, 2025 •

Copy link
Copy Markdown
Member Author

I think for reclaim policy changes, the actual impacts are not obvious as long-term and systematic behavor. We need to define a standard way to do evaluations and use it as an apple-to-apple way to prove that any new policy results in better bimodel utilization distribution, and most importantly, less write amplifications from background reclaim.

Also, different policies may perform differently under various utilization levels, it can be case-by-case.

The classical COSY_BENEFIT was proved to be reasonable, with a good backing theory from paper.

If we can prove ignoring modify-time and increasing generation upperbound is benefitial (even only under certain utilization level), I think the better way is to introduce an independent policy, and make generation-upperbound configurable (with cleanups to make it easier to maintain, as it is currently only statically implemented).

Yeah, actually, my initial thought was that we might not need to consider the age when deciding which segment to reclaim so that we can avoid the case in https://tracker.ceph.com/issues/72087. I haven't thought thoroughly about dropping modify_time, just wanted to throw in an idea:-) Will try to dig into it.

@github-actions

github-actions Bot commented Jul 15, 2025 •

Copy link
Copy Markdown

Config Diff Tool Output

+ added: seastore_hot_tier_generations (crimson.yaml.in)
+ added: seastore_cold_tier_generations (crimson.yaml.in)
+ added: seastore_segment_cleaner_gc_formula (crimson.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.

@xxhdx1985126 xxhdx1985126 changed the title crimson/os/seastore/async_cleaner: set minimum reclaimable ratio for a segment to be reclaimed crimson/os/seastore/epm: make max_generation and gc_formula configurable Jul 15, 2025
@xxhdx1985126

Copy link
Copy Markdown
Member Author

@cyx1231st Hi, I've just modified the PR as discussed offline yesterday:

  1. make max generation related variables configurable;
  2. make omap node evictable.

Please take a look, thanks:-)

Comment thread src/common/options/crimson.yaml.in Resolved
Comment thread src/common/options/crimson.yaml.in Resolved
Comment thread src/common/options/crimson.yaml.in Resolved
@Matan-B Matan-B moved this from Awaits review to In Progress in Crimson Jul 15, 2025
@xxhdx1985126

Copy link
Copy Markdown
Member Author

@cyx1231st Hi, I've just modified the PR as suggested, please take a look, thanks:-)

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test make check

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test api

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test make check

@cyx1231st cyx1231st left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM except for the comments.

Comment thread src/crimson/os/seastore/cache.cc Resolved
@xxhdx1985126

Copy link
Copy Markdown
Member Author

@cyx1231st I've just modified the code as suggested, please take a look, again, thanks:-)

@xxhdx1985126

Copy link
Copy Markdown
Member Author

The following tests FAILED:
34 - run-rbd-unit-tests-127.sh (Failed)

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test make check

1 similar comment
@cyx1231st

Copy link
Copy Markdown
Member

jenkins test make check

@cyx1231st cyx1231st moved this from In Progress to Needs QA in Crimson Jul 23, 2025
@cyx1231st

Copy link
Copy Markdown
Member

@cyx1231st

Copy link
Copy Markdown
Member

jenkins test make check

@Matan-B

Matan-B commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

@Matan-B

Matan-B commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check

@Matan-B
Matan-B merged commit e18ad7e into ceph:main Jul 30, 2025
@Matan-B Matan-B moved this from Needs QA to Merged (Main) in Crimson Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged (Pre Umbrella cutoff)

Development

Successfully merging this pull request may close these issues.

3 participants