Skip to content

Mgr: Allow autoscaling for overlapped roots - #68532

Merged
Ericmzhang merged 4 commits into
ceph:mainfrom
Ericmzhang:wip-overlapped-roots-autoscale
Jun 15, 2026
Merged

Ericmzhang merged 4 commits into
ceph:mainfrom
Ericmzhang:wip-overlapped-roots-autoscale

Conversation

@Ericmzhang

@Ericmzhang Ericmzhang commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem:

  • If crush roots have overlapping roots, they do not autoscale.

Solution:

  • Do not check for overlapping roots and allow all roots to autoscale. PG budget assigned for root is sum(mon_target_pg_per_osd/ #roots containing osd). Changed CrushSubtreeResourceStatus to be unique for each crush root instead of shared across overlapping roots.

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

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.

@Ericmzhang Ericmzhang changed the title Wip overlapped roots autoscale Mgr: Allow autoscaling for overlapped roots Apr 22, 2026
@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch from 1784185 to 3df3c6a Compare April 22, 2026 17:01
@Ericmzhang

Copy link
Copy Markdown
Contributor Author

Fix mypy build error

@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch from 3df3c6a to 429eed9 Compare May 26, 2026 22:35

@kamoltat kamoltat 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.

I approved the code changes for this. However, we are missing some documentation changes in: doc/rados/operations/placement-groups.rst. In Automated scaling section we should remove the mention of overlapping roots and failing to scale. Instead we should include a section that explains the autoscaler logic when there are more than 1 roots that overlaps in terms of OSDs and how pg_target are distributed based on ratio.

We also might want to add a ceph/PendingReleaseNotes
something like

  • RADOS: pg autoscaler allow overlapped roots, each root will be given a pg_target based on the number of OSDs under the root relative to other roots.

Comment thread src/pybind/mgr/pg_autoscaler/module.py Outdated
@@ -709,7 +697,7 @@ def _calculate_final_pool_pg_target(
final_ratio = 1 / (pool_count - root_map[root_id].pool_used)
for (pg_target, size, bias, bulk, autoscale), group in pool_group.items():
pg_target = int(final_ratio * root_map[root_id].pg_left)
self.log.debug("updating group with target {} size {} bias {} bulk {} autoscale {}".format(pg_target, size, bias, bulk, autoscale))
self.log.info("updating group with target {} size {} bias {} bulk {} autoscale {}".format(pg_target, size, bias, bulk, autoscale))

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.

should we keep the log to debug level? I'm just worried about polluting the mgr logs if we go info level

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.

Changed this back to debug

Comment on lines +486 to +488
for osd, root_ids in osd_uses_by_root.items():
for root_id in root_ids:
result[root_id].pg_target += self.mon_target_pg_per_osd // len(root_ids)

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.

Ack the math checks out, here is how I validate it:

mon_target_pg_per_osd = 300

rootid -1 : {0, 1, 2, 3}
rootid -2 : {0, 1}
rootid -3 : {2, 3}

0: {-1, -2}
1: {-1, -2}
2: {-1, -3}
3: {-1, -3}

result: [-1: pg_target: 150 , -2: 150 , -3: 0]

result: [-1: pg_target: 300, -2: 300, -3: 0]

result: [-1: pg_target: 450, -2: 300, -3: 150]

result: [-1: pg_target: 600, -2: 300, -3: 300]

600 + 300 + 300 = 1200

mon_target_pg_per_osd * (num_osds) = 300 * 4 = 1200

Therefore, we are actually allocating the pg_target for each roots based on the OSDs that are under

@parth-gr

Copy link
Copy Markdown
Contributor

@Ericmzhang can you test creating the 4 crush rules

rule zone-1-only
  step take zone us-east-1
  step chooseleaf firstn 3 type host
  step emit

rule zone-2-only
  step take zone us-east-2
  step chooseleaf firstn 3 type host
  step emit

rule zone-3-only
  step take zone us-east-3
  step chooseleaf firstn 3 type host
  step emit

rule default
   step take default 
  step chooseleaf firstn 3 type host
  step emit

If the atuoscaler still works with these crush rules

@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch from 051d690 to a9d9892 Compare May 27, 2026 23:03
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch from a9d9892 to e7c9de9 Compare May 27, 2026 23:03
@Ericmzhang

Copy link
Copy Markdown
Contributor Author

@Ericmzhang can you test creating the 4 crush rules

rule zone-1-only
  step take zone us-east-1
  step chooseleaf firstn 3 type host
  step emit

rule zone-2-only
  step take zone us-east-2
  step chooseleaf firstn 3 type host
  step emit

rule zone-3-only
  step take zone us-east-3
  step chooseleaf firstn 3 type host
  step emit

rule default
   step take default 
  step chooseleaf firstn 3 type host
  step emit

If the atuoscaler still works with these crush rules

Added test in qa/workunits/mon/pg_autoscaler.sh

@Ericmzhang

Copy link
Copy Markdown
Contributor Author

Made changes for review above. Removed overlapped roots failure mention in docs and added example of budgeting with overlapped roots.

@Ericmzhang
Ericmzhang marked this pull request as ready for review May 27, 2026 23:18
@Ericmzhang
Ericmzhang requested review from a team as code owners May 27, 2026 23:18

@anthonyeleven anthonyeleven left a comment

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.

Docs lgtm with one suggestion.

.. _overlapping_crush_roots:

Overlapped CRUSH Roots PG Budget
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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.

Nit: suggest s/Overlapped/Overlapping/
this is minor. Same in the pending release notes.

Less minor is that I think the ~~ line is one char too long.

@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch from d716c2d to ab40fbe Compare May 28, 2026 15:25
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch from ab40fbe to 9e39c27 Compare May 28, 2026 15:26
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch 2 times, most recently from 7b95255 to 8860431 Compare June 9, 2026 06:24
@Ericmzhang

Copy link
Copy Markdown
Contributor Author

rebase from main

@rzarzynski

Copy link
Copy Markdown
Contributor

(just a little reminder: fixups need to be squashed before the merge and the signed-off-by check must pass).

@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch from 308ec43 to 0e0d30e Compare June 9, 2026 20:15
@github-actions github-actions Bot added the cephfs Ceph File System label Jun 9, 2026
Remove references to overlapped roots. Assign PG budget per root as sum(mon_target_pg_per_osd/# roots that contain OSD)

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

Signed-off-by: Eric Zhang <[email protected]>
No longer need to detect which roots are overlapping. Instead test PG budget allocation when roots overlap

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

Signed-off-by: Eric Zhang <[email protected]>
Remove mention of overlapped roots failing to scale and added
example of adding overlapped roots.
Added mention of changes in PendingReleaseNotes

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

Signed-off-by: Eric Zhang <[email protected]>
Added overlapped roots test case for CRUSH rules
rule zone-1-only
  step take zone us-east-1
  step chooseleaf firstn 3 type host
  step emit

rule zone-2-only
  step take zone us-east-2
  step chooseleaf firstn 3 type host
  step emit

rule zone-3-only
  step take zone us-east-3
  step chooseleaf firstn 3 type host
  step emit

rule default
   step take default
  step chooseleaf firstn 3 type host
  step emit

and osd tree
    -1         6.00000  root default
     -8         6.00000      region us-east
     -5         2.00000          zone us-east-1
    -13         1.00000              host host0
      0    ssd  1.00000                  osd.0
    -14         1.00000              host host1
      1    ssd  1.00000                  osd.1
     -6         2.00000          zone us-east-2
    -15         1.00000              host host2
      2    ssd  1.00000                  osd.2
    -16         1.00000              host host3
      3    ssd  1.00000                  osd.3
     -7         2.00000          zone us-east-3
    -17         1.00000              host host4
      4    ssd  1.00000                  osd.4
    -18         1.00000              host host5
      5    ssd  1.00000                  osd.5

    -1: pg_target = 300
    -5: pg_target = 100
    -6  pg_target = 100
    -7: pg_target = 100

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

Signed-off-by: Eric Zhang <[email protected]>
@Ericmzhang
Ericmzhang force-pushed the wip-overlapped-roots-autoscale branch from 0e0d30e to 7f9e383 Compare June 9, 2026 20:16
@Ericmzhang

Copy link
Copy Markdown
Contributor Author

Squashed fixups

@Ericmzhang

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@sseshasa

Copy link
Copy Markdown
Contributor

@Ericmzhang
Ericmzhang merged commit 69c30a7 into ceph:main Jun 15, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

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
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/27564195204

hillpd added a commit to hillpd/hotsos that referenced this pull request Sep 22, 2026
Use the first take step of each in-use rule as its root, as the mgr does,
so multi-take rules (ssd-primary) are not flagged against themselves.
Report each overlapping pair with the rules and pools on each side and
the corrective action. Gate on Pacific through Squid; from Tentacle the
autoscaler budgets PGs across shared OSDs instead (ceph/ceph#68532).
Reword the log-based conclusion to match and let the crush dump one take
precedence. Add tentacle to the release tables, drop the unused crush
tree command, and give the crush dump fixtures full bucket data.

Signed-off-by: Dan Hill <[email protected]>
hillpd added a commit to hillpd/hotsos that referenced this pull request Sep 22, 2026
Use the first take step of each in-use rule as its root, as the mgr does,
so multi-take rules (ssd-primary) are not flagged against themselves.
Report each overlapping pair with the rules and pools on each side and
the corrective action. Gate on Pacific through Squid; from Tentacle the
autoscaler budgets PGs across shared OSDs instead (ceph/ceph#68532).
Reword the log-based conclusion to match and let the crush dump one take
precedence. Add tentacle to the release tables, drop the unused crush
tree command, and give the crush dump fixtures full bucket data.

Signed-off-by: Dan Hill <[email protected]>
hillpd added a commit to hillpd/hotsos that referenced this pull request Sep 22, 2026
Use the first take step of each in-use rule as its root, as the mgr does,
so multi-take rules (ssd-primary) are not flagged against themselves.
Report each overlapping pair with the rules and pools on each side and
the corrective action. Gate on Pacific through Squid; from Tentacle the
autoscaler budgets PGs across shared OSDs instead (ceph/ceph#68532).
Reword the log-based conclusion to match and let the crush dump one take
precedence. Add tentacle to the release tables, drop the unused crush
tree command, and give the crush dump fixtures full bucket data.

Signed-off-by: Dan Hill <[email protected]>
hillpd added a commit to hillpd/hotsos that referenced this pull request Sep 23, 2026
Use the first take step of each in-use rule as its root, as the mgr does,
so multi-take rules (ssd-primary) are not flagged against themselves.
Report each overlapping pair with the rules and pools on each side and
the corrective action. Gate on Pacific through Squid; from Tentacle the
autoscaler budgets PGs across shared OSDs instead (ceph/ceph#68532).
Reword the log-based conclusion to match and let the crush dump one take
precedence. Add tentacle to the release tables, drop the unused crush
tree command, and give the crush dump test data full bucket fields.

Signed-off-by: Dan Hill <[email protected]>
hillpd added a commit to hillpd/hotsos that referenced this pull request Sep 23, 2026
Use the first take step of each in-use rule as its root, as the mgr does,
so multi-take rules (ssd-primary) are not flagged against themselves.
Report each overlapping pair with the rules and pools on each side and
the corrective action. Gate on Pacific through Squid; from Tentacle the
autoscaler budgets PGs across shared OSDs instead (ceph/ceph#68532).
Reword the log-based conclusion to match and let the crush dump one take
precedence. Add tentacle to the release tables, drop the unused crush
tree command, and give the crush dump test data full bucket fields.

Fixes canonical#1139.

Signed-off-by: Dan Hill <[email protected]>
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.

7 participants