Skip to main content
RunBook Academy

CephXII · BlueStoreBlueStore

The DB device — RocksDB, omap, and compaction

Advanced⏱ ~16 mincephceph-kvstore-tool

What you'll learn

  • Describe what RocksDB stores for BlueStore
  • Explain compaction and its performance effect
  • Monitor RocksDB size and health
  • Respond to a DB device under pressure

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

Not yet marked complete on this device.

Why this matters in production

RocksDB is where every metadata operation lands, and its behaviour — particularly compaction — produces latency patterns that look like device problems and are not.

What RocksDB holds

ContentGrows with
onodes (object metadata)object count
extent maps (data location)object count and fragmentation
allocation statedevice size and fragmentation
omap key/value databucket indexes, CephFS directories
deferred write datasmall-write rate

Object count is the primary driver. A pool with a hundred million small objects generates far more RocksDB content than one with the same bytes in large objects.

ceph osd df tree                     # META column
ceph daemon osd.12 perf dump bluefs | jq '.bluefs.db_used_bytes, .bluefs.db_total_bytes'

Compaction

RocksDB is a log-structured merge tree. Writes go to the top level; periodically, levels are merged and rewritten downward. That is compaction, and it is I/O-intensive.

During compaction an OSD may:

  • consume significant device bandwidth on the DB device,
  • show elevated commit latency,
  • appear as an outlier in ceph osd perf for minutes.

This is normal. It is also indistinguishable from a device problem unless you look:

ceph daemon osd.12 perf dump rocksdb | jq '.rocksdb.compact, .rocksdb.compact_range'
cephadm logs --name osd.12 | grep -i compact

Manual compaction

ceph osd compact 12
ceph tell osd.12 compact

This triggers a full compaction, which is heavy and blocks that OSD’s work substantially. It is occasionally useful after a large deletion, when RocksDB holds a great deal of obsolete data, but it is not a routine maintenance action and should not be scripted to run periodically.

Offline inspection

# with the OSD stopped
ceph-kvstore-tool bluestore-kv /var/lib/ceph/osd/ceph-12 stats
ceph-kvstore-tool bluestore-kv /var/lib/ceph/osd/ceph-12 compact

Useful when an OSD will not start due to RocksDB size or corruption, and a genuine last resort rather than a tuning step.

Responding to DB pressure

  1. Confirm it is DB pressure: META column high, db_used_bytes approaching db_total_bytes, spillover warnings.
  2. Check object count — is the metadata volume expected for the workload?
  3. For RGW, check bucket shard counts; under-sharded buckets concentrate omap.
  4. If genuinely undersized, plan OSD recreation with larger DB devices.
  5. Do not schedule periodic manual compaction as a workaround.

Quiz

Knowledge check · 4 questions

  1. Q1. An OSD periodically becomes a latency outlier for a few minutes and then returns to normal. SMART is clean. What is the most likely cause?

  2. Q2. Running ceph tell osd.N compact blocks that OSD's own work substantially for the duration, unlike RocksDB's ordinary background compaction.

  3. Q3. An RGW cluster shows BLUEFS_SPILLOVER on 20 of 60 OSDs. DB devices are 40 GB per 8 TB HDD. Plan the response.

    RGW cluster with 300 million objects across several buckets, the largest holding 180 million. DB devices were sized at 40 GB per 8 TB data device, following a 0.5% guideline someone found. Bucket index pool shares the same HDD-backed CRUSH rule as the data pool. Spillover appeared gradually over the past year as object count grew.

  4. Q4. Explain why RGW clusters put more pressure on RocksDB than RBD clusters of the same capacity.

Passing score: 75%. Answers are checked in this browser.

Production discipline

Size DB devices from measured META usage rather than from a remembered percentage, and expect RGW to need an order of magnitude more than RBD for the same capacity. Recognise compaction as the cause of periodic latency outliers with clean SMART, and resist replacing devices for it. Never schedule manual compaction periodically — it imposes the disruption it is meant to avoid, on a timetable unrelated to need. And on a constrained budget, move the RGW bucket index pool to NVMe before anything else.

Cross-course references

  • Ceph: Part XLV (RADOS Gateway) for bucket index sharding.
  • Ceph: Part XII lesson on BlueFS for the DB device layout.
  • Ceph: Part LXVIII (OSD Latency) for separating compaction from faults.