CephXXI · PG AutoscalePG Autoscale
pg_autoscale_mode: on, warn, and off
What you'll learn
- Describe what the pg_autoscaler manager module does
- Distinguish the on, warn, and off modes
- Set the mode globally and per pool
- Choose a mode appropriate to a pool's role
Prerequisites
None — start here.
Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18
Why this matters in production
Choosing pg_num by hand was, for years, the single most common way to
misconfigure a Ceph cluster. Pick it too low and every OSD carries a few
enormous PGs, so balance is coarse and recovery is lumpy. Pick it too
high and the OSDs spend memory and CPU on PG bookkeeping that buys
nothing. The autoscaler exists to take that decision off your plate — but
it is a manager module making an inference from pool statistics, and you
still need to know what it will do before you let it do it.
The three modes
ceph osd pool get rbd-prod pg_autoscale_mode
# pg_autoscale_mode: on
off — the module ignores the pool entirely. No suggestions, no
warnings, no changes. pg_num is whatever you last set.
warn — the module computes what it thinks pg_num should be, and
if the current value is far enough off, raises a health warning. It never
changes anything. This is the “tell me, don’t touch it” mode.
on — the module computes the target and applies it, adjusting
pg_num in the background over time.
Set it per pool, or set the default for pools created from now on:
ceph osd pool set rbd-prod pg_autoscale_mode warn
ceph config set global osd_pool_default_pg_autoscale_mode warn
What “applies it” actually means
on does not slam pg_num to the new value. It moves pg_num toward
the target, and each step causes PG splits or merges, which cause data
movement. The pace is governed by the usual backfill throttles, so an
autoscaler change looks like an ordinary rebalance in ceph -s.
The important consequence: an autoscaler decision made at 03:00 produces recovery traffic at 03:00. You did not schedule it and you were not watching.
Where the module lives
pg_autoscaler is a manager module, enabled by default:
ceph mgr module ls | grep pg_autoscaler
If the active manager is down or the module is disabled, no suggestions
appear and no scaling happens — a silent failure mode worth knowing about
when autoscale-status comes back empty.
Quiz
Knowledge check · 4 questions
Q1. What does `pg_autoscale_mode warn` do when the current pg_num differs substantially from the computed target?
Q2. With pg_autoscale_mode set to on, pg_num jumps immediately to the computed target value.
Q3. Which mode fits each pool, and why?
You run a cluster with three pools: `rbd-vms` backing production VM disks, `cephfs-meta` for a shared filesystem's metadata, and `backup-objects`, a large RGW bucket pool written to nightly by a backup job. Management asks you to stop hand-tuning pg_num.
Q4. `ceph osd pool autoscale-status` returns no rows at all. Name the first thing to check and why.
Passing score: 75%. Answers are checked in this browser.
Production discipline
Record the mode for every pool in the same place you record its
size and rule — a pool whose autoscale mode nobody remembers setting is a
pool that will move data at an inconvenient hour. When you set warn,
commit to actually reading the warnings; a permanently-ignored health
warning trains the team to ignore the health output entirely.
Cross-course references
- Kubernetes: pool PG counts affect the latency of RBD volumes backing StatefulSet PVCs
- Linux: manager module scheduling is ordinary process work — the mgr is a userspace daemon like any other