Skip to content

src/common/options: Increase autoscaler PG target and overload values - #60492

Merged
anthonyeleven merged 2 commits into
ceph:mainfrom
anthonyeleven:more-pgs
Jun 11, 2026
Merged

anthonyeleven merged 2 commits into
ceph:mainfrom
anthonyeleven:more-pgs

Conversation

@anthonyeleven

@anthonyeleven anthonyeleven commented Oct 25, 2024 •

Copy link
Copy Markdown
Contributor

src/common/options: Increase autoscaler PG target and overload values

With modern Ceph releases and hardware, the existing values hamper more than they help, especially with the obsolescence of Filestore. This PR increases both the autoscaler's default ratio target and the overload threshold above which an OSD won't activate.

Fixes: https://tracker.ceph.com/issues/68724
Signed-off-by: Anthony D'Atri [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
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@markhpc
markhpc requested a review from a team October 25, 2024 19:52
@markhpc markhpc added the core label Oct 25, 2024
@markhpc

markhpc commented Oct 25, 2024

Copy link
Copy Markdown
Member

In general I'm for this, with the caveat that at very large OSD counts it could cause certain problems to show up faster. I'd like to see us turn pglog length into a per-pool attribute and control it through the priority cache. Also adjust the pg stat update interval for the mgr based on latency. The end goal would be to allow for a high initial count of PGs per OSD and only perform pg autoscaling when we exceed some boundary conditions that can't be solved via other mechanisms.

@anthonyeleven

anthonyeleven commented Oct 25, 2024 •

Copy link
Copy Markdown
Contributor Author

In general I'm for this, with the caveat that at very large OSD counts it could cause certain problems to show up faster. I'd like to see us turn pglog length into a per-pool attribute and control it through the priority cache. Also adjust the pg stat update interval for the mgr based on latency. The end goal would be to allow for a high initial count of PGs per OSD and only perform pg autoscaling when we exceed some boundary conditions that can't be solved via other mechanisms.

Thanks. Re the last sentence, that sounds like the bulk flag on a given pool.

Re the first through third sentences, do you have a sense of how large pglogs are? Are talking additional tens of MB memory per OSD? Hundreds of MB?

My gut wants to set both of these values twice again higher but I thought it prudent to be conservative.

@markhpc

markhpc commented Oct 31, 2024

Copy link
Copy Markdown
Member

Re the first through third sentences, do you have a sense of how large pglogs are? Are talking additional tens of MB memory per OSD? Hundreds of MB?

Sadly in the case of erasure coding with xattrs or (maybe? I need to check) OMAP it appears to be unbounded. We hit this last year and it was particularly rough. We had to set the pglog size to 1 just to avoid having OSDs go OOM in a particularly nasty corner case. Typically however, I'd expect between 10s-100s of MB depending on how many PGs we target. This is why I want to change PG log to be per-pool and based on a memory target rather than a hard count. It kills two birds with one stone as the saying goes.

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

Do you think this is mergeable for now?

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

bump

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

jenkins retest this please

3 similar comments
@anthonyeleven

Copy link
Copy Markdown
Contributor Author

jenkins retest this please

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

jenkins retest this please

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

jenkins retest this please

@markhpc

markhpc commented Jan 9, 2025

Copy link
Copy Markdown
Member

@rzarzynski I can approve this, but I want to make sure we get any dissenting views into the discussion before doing so. Is there anyone on core that would like to give feedback before we move forward? One potential change I would like to make is to reduce the pglog size in conjuction with increasing the PG log count. We should note that this will hit the mgr harder with stat updates, but I think it's still a good change overall.

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

I'm also looking into ensuring that the autoscaler doesn't kick in during an upgrade that effects this change, as that could be disruptive and conceivably significantly draw out the elapsed time to upgrade.
@adk3798 any thoughts in that regard? Do we already do this? Could we?

@kamoltat

kamoltat commented Jan 16, 2025 •

Copy link
Copy Markdown
Member

Hi @anthonyeleven

I'm good with merging this PR since I don't see any risks associated with PGs misbehaving due to this change with any cluster size.

mon_target_pg_per_osd --> This is used to calculate the total amount of PGs we target for the cluster (PG budget at the start of autoscaler module). It is used in conjunction with osd_count. However, if it is not used with the bulk flag, and the capacity is low, then this won't have much effect. see: #61307 (comment)

mon_max_pg_per_osd --> This won't affect the autoscaler module directly, but more of MON and OSD code, basically allowing for more PGs per OSDs.

@kamoltat

Copy link
Copy Markdown
Member

@rzarzynski I can approve this, but I want to make sure we get any dissenting views into the discussion before doing so. Is there anyone on core that would like to give feedback before we move forward? One potential change I would like to make is to reduce the pglog size in conjuction with increasing the PG log count. We should note that this will hit the mgr harder with stat updates, but I think it's still a good change overall.

Hi @markhpc I would love to discuss the pglog route, although I have to admit my knowledge of PG logs is limited, will read on this and maybe we can have a better discussion after I educate myself.

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

Thanks, Kamoltat.

mon_target_pg_per_osd
This is used to calculate the total amount of PGs we target for the cluster (PG budget at the start of autoscaler module). It is used in conjunction with osd_count. However, if it is not used with the bulk flag, and the capacity is low, then this won't have much effect.

I thought this defines the autoscaler's target for the number of PG replicas per OSD, aka PG ratio, the PGS column at extreme right of ceph osd df output. Most users would benefit from PG ratios in the 150-200 range vs those that I see all the time in the 50-60 range, which is too high granularity for good balancing and performance. E.g., I see index pools that don't even use all available OSDs. Is that target defined by a different option?

mon_max_pg_per_osd --> This won't affect the autoscaler module directly, but more of MON and OSD code, basically allowing for more PGs per OSDs.

Yep. But it should be raised in conjunction with the PG ratio target, as more PG replicas per OSD will mean an increased chance that a topology change, notably the loss of a host or other failure domain, will run up the PG replica count on some OSDs above the limit, resulting in inactive PGs. I've seen this in practice, especially when a cluster contains OSDs of very different weights. In production I personally set this to 1000 to avoid that dynamic, as it can be tricky to troubleshoot if one isn't aware. PG overdose protection is still wise, I raise the value here to avoid people running into the limit.

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

BZ 2336779 tracks an RFE to be able to disable the autoscaler during upgrades, so that an upgrade that introduces these changes won't be lengthened by having to wait for PG splittings. We have a customer with clusters in excess of 2900 OSDs, so this effect could be significant.

@mmgaggle

mmgaggle commented Feb 1, 2025

Copy link
Copy Markdown
Member

I support this, I personally like to target anywhere between 200 and 250 PGs per OSD.

@bill-scales

Copy link
Copy Markdown
Contributor

Sadly in the case of erasure coding with xattrs or (maybe? I need to check) OMAP it appears to be unbounded. We hit this last year and it was particularly rough. We had to set the pglog size to 1 just to avoid having OSDs go OOM in a particularly nasty corner case. Typically however, I'd expect between 10s-100s of MB depending on how many PGs we target. This is why I want to change PG log to be per-pool and based on a memory target rather than a hard count. It kills two birds with one stone as the saying goes.

Erasure coding doesn't support OMAP yet so must have been xattrs.

pglog entries for EC are typically about 700 bytes (encoded) at the moment for a typical write I/O, but will be larger if xattrs are modified because the log entry will need to store the old value of the modified xattrs. The conf setting osd_max_pg_log_entries currently defaults to 10000 so that says the log will be ~7MB per PG. There are extreme cases where EC has to keep a longer pglog.

I agree that long term it would make sense to make this a per pool limit because it makes more sense to have a fixed number of log entries per pool than per PG, especially when autoscaler is adjusting the number of PGs. There is also scope to reduce the size of pglog entries for EC - it currently stores an old copy of OI, storing a delta of what has changed between the old OI and new OI would be much more efficient and could save 200+ bytes per entry.

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

jenkins test api

@Matt1360

Matt1360 commented Mar 6, 2025

Copy link
Copy Markdown
Member

Hi folks, from the discussion I think there are a few things to confirm before hitting the button:

  • Should we be reducing osd_{min,max}_pg_log_entries to help combat memory increase during recovery scenarios?
    • Does anyone have a suggestion for values to reduce it to? Doubling the PG target suggests halving the pglog values, but is that appropriate?
  • Did we get confirmation that the autoscaler won't kick in during an upgrade?
    • It looks like there might be an RFE to do this, what is its status?
    • Do we consider that a blocker?

From our experience, we have seen an incident or two where pglog length has caused OOM conditions for a single OSD on boxes with 512G of RAM. In that kind of extreme, reducing that to log length to 1 (effectively disabled) was our way out (which is fine in our rbd cases anyway, because the pglog rotates so fast that recovery instead of backfill never happens).

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

I will defer to Mark et all re pg logs.

Re disabling the autoscaler, I have not seen any movement on the RFE. I will defer to Mark, Josh, et al whether that is a blocker. If not available RSN, we might consider suggesting disabling manually before performing an upgrade that changes the effective value, then re-enabling when the dust settles. I mainly don't want upgrades to be slowed down by PG splitting.

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

I've entered https://github.com/ceph/ceph/pull/62367/files which adds advice to disable the autoscaler for the duration of an upgrade. This is not odious or harmful in the general case, and if we can merge this PR so that the target value change goes out in Tentacle, we need not block on my RFE for the upgrade process to automagically suspend PG splitting / merging.

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

The API failure here I think is a red herring.

@ljflores

ljflores commented Jun 3, 2026

Copy link
Copy Markdown
Member

Bump. With @ljflores 's push to fix the conflict my git-fu isn't up to updating the test. Would it suffice for me to enter another PR to update the test?

#69182

I closed this and cherry-picked the commit on to this PR to keep everything together.
I also resolved the merge conflict.

@ljflores

ljflores commented Jun 3, 2026

Copy link
Copy Markdown
Member

Let's retest this. @SrinivasaBharath can you help?

@yuriw

yuriw commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri4-testing-20260603.222947-main.

@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

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

I’m about ready to give up.

@anthonyeleven anthonyeleven mentioned this pull request Jun 8, 2026
4 of 14 tasks
@yuriw

yuriw commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@anthonyeleven pls rebase

@Ericmzhang

Copy link
Copy Markdown
Contributor

@anthonyeleven Finished rebasing

@Ericmzhang

Copy link
Copy Markdown
Contributor

Rebased again

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

Rebased again

Thanks!

@anthonyeleven

Copy link
Copy Markdown
Contributor Author

@yuriw when might this get a qa run so I can merge?

@anthonyeleven
anthonyeleven merged commit d93121a into ceph:main Jun 11, 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/27315286412

batrick pushed a commit that referenced this pull request Jul 20, 2026
Signed-off-by: Anthony D'Atri <[email protected]>
(cherry picked from commit b54ed6d)
batrick added a commit that referenced this pull request Jul 20, 2026
* refs/pull/69452/head:
	qa/workunits/mon: Update pg_autoscaler.sh in conjunction with #60492
	src/common/options: Increase autoscaler PG target and overload values

Reviewed-by: Laura Flores <[email protected]>
AnuragRaut08 pushed a commit to AnuragRaut08/ceph that referenced this pull request Sep 30, 2026
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.