惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
博客园_首页
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
博客园 - 司徒正美
有赞技术团队
有赞技术团队
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog

OneUptime Blog

How to Monitor Azure App Services (PaaS) with OpenTelemetry Grafana Stack vs OneUptime: DIY Observability or Unified Platform? Your AI Workloads Are About to Blow Up Your Observability Bill The Great Observability Consolidation Is Here How to Write Custom Object Classes for Ceph How to Write Custom Ceph Manager Modules How to Write a ceph.conf Configuration File How to Use Rook-Ceph with OpenShift How to Use Rook-Ceph with Longhorn for Comparison How to Configure Volume Snapshot Class for RBD in Rook How to Configure VolumeReplicationClass Scheduling Intervals in Rook How to Set Up Volume Replication with Rook-Ceph How to Create Volume Group Snapshots with Rook CSI How to Visualize Ceph Network Performance in Grafana How to Enable Virtual Host-Style Bucket Access in Rook How to View Runtime Configuration via Admin Socket How to View Quota Settings and Update Stats in Ceph RGW How to View PG Scaling Recommendations with autoscale-status How to View PG Distribution via Admin Socket How to View Performance Metrics in the Ceph Dashboard How to View OSD Performance Counters in Ceph How to View Connection Status via Admin Socket How to View Ceph Cluster Summary Dashboard via CLI How to Version Control Rook-Ceph Configuration How to Version Control Ceph Infrastructure with Terraform How to Verify Kubernetes Node Requirements for Rook-Ceph Deployment How to Verify Health Before and After Rook Upgrades How to Verify Data Integrity with Deep Scrubbing How to Verify Complete Rook-Ceph Cleanup How to Verify Backup Integrity from Ceph Snapshots
How to Understand Placement Groups in Ceph
Nawaz Dhandala · 2026-03-31 · via OneUptime Blog

What Are Placement Groups

Placement Groups (PGs) are the internal sharding layer between objects and OSDs in Ceph. Rather than mapping each object directly to a specific OSD (which would require an enormous lookup table), Ceph first maps objects to a PG, then maps PGs to OSDs via CRUSH.

This two-level indirection makes it feasible to manage millions of objects efficiently. Each PG is a logical group of objects that share the same set of OSDs.

How Objects Map to PGs

hash(object_name) % pg_num = PG_ID
CRUSH(PG_ID) = [osd.4, osd.11, osd.19]

The hash is computed client-side, so no central service is required. Changing pg_num causes objects to remap across PGs and triggers data migration.

PG States

Every PG is always in one or more states. Understanding states is essential for cluster diagnostics:

kubectl exec -it rook-ceph-tools -n rook-ceph -- ceph pg stat

Common states:

StateMeaning
active+cleanHealthy - all replicas present
active+degradedServing I/O but missing replicas
peeringOSDs negotiating PG ownership
staleNo primary OSD reporting for this PG
backfillingNew OSDs receiving object copies
recoveringRebuilding objects after OSD failure
undersizedFewer active OSDs than required

Checking PG Health

# Summary of PG states
kubectl exec -it rook-ceph-tools -n rook-ceph -- ceph pg stat

# Find stuck PGs
kubectl exec -it rook-ceph-tools -n rook-ceph -- ceph pg dump_stuck

# Query a specific PG
kubectl exec -it rook-ceph-tools -n rook-ceph -- ceph pg 2.1e query

Choosing the Right pg_num

Too few PGs cause uneven data distribution; too many create excessive overhead (each PG consumes ~150 KB of OSD memory). The general formula:

Target PGs per OSD: 100-200
pg_num = (OSDs x target_pgs_per_osd) / replication_size

For 12 OSDs with 3x replication targeting 100 PGs per OSD:

pg_num = (12 x 100) / 3 = 400

Round to the nearest power of 2: 512.

Set PG count in a Rook pool:

apiVersion: ceph.rook.io/v1
kind: CephBlockPool
metadata:
  name: replicapool
  namespace: rook-ceph
spec:
  replicated:
    size: 3
  parameters:
    pg_num: "512"
    pgp_num: "512"

PG Autoscaling

Ceph includes a PG autoscaler that adjusts pg_num based on pool usage. Enable it for a pool:

ceph osd pool set replicapool pg_autoscale_mode on
ceph osd pool autoscale-status

The autoscaler monitors pool sizes and adjusts PG counts to maintain the target PGs-per-OSD ratio without manual intervention.

PG and Recovery Granularity

Recovery after an OSD failure happens at the PG level. Each PG independently recovers by copying objects from healthy replicas to new OSDs. More PGs mean finer-grained recovery and better parallelism, but also more overhead per PG.

# Watch recovery progress
kubectl exec -it rook-ceph-tools -n rook-ceph -- ceph -w | grep recovering

Summary

Placement Groups are the fundamental distribution unit in Ceph, sitting between objects and OSDs. They enable efficient distributed hashing, fine-grained recovery parallelism, and manageable metadata overhead. Choosing the right pg_num, enabling autoscaling, and understanding PG states are core skills for operating healthy Rook-Ceph clusters at scale.