CephXVIII · Placement GroupsPlacement Groups
Why placement groups exist
What you'll learn
- Explain the scaling problem PGs solve
- Describe what an OSD tracks per PG rather than per object
- Relate PG count to memory, peering, and recovery cost
- Justify the 100-200 PGs per OSD guidance
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
Placement groups are the one Ceph concept with no equivalent in single-server storage, and almost every capacity, memory, and recovery consideration touches them.
The problem they solve
Without PGs, the cluster would need to track, for each object, which OSDs hold it. On a petabyte of 4 MiB objects that is 260 million entries — a table growing with data volume, replicated for durability, and consulted constantly.
With PGs there are two mappings:
object → PG cheap hash, no state
PG → OSDs CRUSH computation over a small map
Neither stores per-object state. The number of PGs is chosen by the operator and stays constant as data grows, so the tracking cost is bounded by cluster size rather than by object count.
What an OSD tracks per PG
- membership: which OSDs are in the acting and up sets,
- a PG log of recent operations,
- peering state and history,
- scrub scheduling and status,
- statistics.
None of this is per object. An OSD holding 200 PGs maintains 200 of each structure whether those PGs hold a thousand objects or a million.
What too few and too many cost
Too few (under about 50 per OSD):
- uneven data distribution, since CRUSH has fewer samples,
- coarse balancing granularity, so the balancer cannot even things out,
- large individual PGs, making each scrub, backfill, and split a long operation,
- limited recovery parallelism.
Too many (over about 300 per OSD):
- more PG logs, peering structures, and per-PG state in memory,
- longer and more memory-hungry peering after every map change,
- more monitor and manager work tracking states.
Computing a target
pg_num per pool ≈ (osd_count x 100) / size / pool_share
For 60 OSDs, size 3, one pool holding everything: 60 × 100 / 3 =
2000, round to 2048. Split across pools by expected data share.
The autoscaler does this arithmetic continuously and is the recommended default; understanding it matters for judging its recommendations and for the cases it does not model.
Quiz
Knowledge check · 4 questions
Q1. What scaling problem do placement groups solve?
Q2. The 100 to 200 PGs per OSD guidance applies to the sum across all pools multiplied by replication.
Q3. A cluster with 430 PGs per OSD runs fine in steady state but OSDs were OOM-killed during the last recovery. Explain the connection.
96 OSDs, 64 GB RAM per host with 12 OSDs each, osd_memory_target 4 GiB. Eleven pools sized independently over four years give 430 PGs per OSD. Steady-state memory usage is around 5.5 GiB per OSD. During a recent host failure, peering pushed several OSDs past available memory and the OOM killer terminated them, which triggered further peering.
Q4. List what an OSD tracks per placement group and explain why that is not per object.
Passing score: 75%. Answers are checked in this browser.
Production discipline
Treat PG count as a cluster-wide budget summed across pools and multiplied by replication, and recount it whenever a pool is added. Size host memory against the peering peak rather than steady state, because peering allocates per-PG state on every OSD simultaneously and that is where an over-PG’d cluster fails. And prefer fewer pools with more PGs each to many pools each carrying the minimum, since the minimums add up faster than anyone expects.
Cross-course references
- Ceph: Part XI (OSD Architecture) for the memory consequences.
- Ceph: Part XX (PG Peering) for what peering allocates.
- Ceph: Part XXI (PG Autoscale) for automating the arithmetic.