Skip to main content
RunBook Academy

CephXXVI · Erasure Coding Trade-offsErasure Coding Trade-offs

CPU cost of erasure coding

Advanced⏱ ~16 minceph

What you'll learn

  • Identify where EC encode and decode work happens
  • Estimate the CPU cost relative to replication
  • Recognise CPU saturation as an EC bottleneck
  • Choose plugins and size OSD hosts accordingly

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

Replication costs no CPU worth mentioning — it is a memcpy and a network send. EC costs arithmetic on every write and on every degraded read, and on a cluster sized for replication that arithmetic can become the limit before the disks or the network do.

Where the work happens

Encode — on the primary OSD, on every write. The primary splits the object into k chunks and computes m coding chunks, then distributes all k+m. The full encode cost lands on one OSD process.

Decode — on the reading OSD, only when a chunk is missing. A healthy read concatenates the k data chunks with no computation. A degraded read gathers k available chunks and solves for the missing ones.

Recovery — on the reconstructing OSD, for every rebuilt chunk. This is the sustained case, and it runs for hours.

Rough magnitude

Modern CPUs with SIMD acceleration encode Reed-Solomon at gigabytes per second per core. For most clusters that is comfortably above what the disks can deliver, so EC encode is not the bottleneck under client load.

Where it bites:

  • Recovery on wide profiles. Sustained decode across many PGs at once, concurrent with client traffic.
  • All-flash clusters. When devices deliver millions of IOPS, the CPU budget per operation gets tight and encode is a real line item.
  • Under-provisioned OSD hosts. A host running 12 OSDs on 8 cores has no headroom for sustained encode plus decode.

The plugins

ceph osd erasure-code-profile set ec42 k=4 m=2 plugin=jerasure technique=reed_sol_van
ceph osd erasure-code-profile set ec42i k=4 m=2 plugin=isa technique=reed_sol_van
PluginNotes
jerasurethe default; portable, well-tested, SIMD-accelerated
isaIntel ISA-L; faster on supported x86 hardware
clayreduces recovery network traffic at some CPU cost
shectrades capacity for reduced recovery I/O

jerasure is the right default. Change it only with a measurement showing the alternative helps on your hardware and workload.

Recognising CPU as the constraint

# on the OSD host during recovery
top -H -p $(pgrep -d, ceph-osd)
mpstat -P ALL 5

The signature is OSD threads pinned near 100% CPU while device utilisation and network throughput both sit well below capacity. On a replicated cluster that combination is rare; on EC during recovery it is the common failure mode.

Quiz

Knowledge check · 4 questions

  1. Q1. On a healthy EC pool, where does the encode work for a write take place?

  2. Q2. A read from a healthy EC pool requires no erasure-code computation.

  3. Q3. Diagnose slow recovery with idle disks.

    An 8+3 EC pool is recovering after a host failure. Recovery throughput is far below expectations. Device utilisation on the OSD hosts is around 20%, the 25 Gb cluster network is at 15%, and yet recovery has been running for two days.

  4. Q4. Why is decode more expensive per operation than encode?

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

Production discipline

Include CPU headroom in the EC design document alongside capacity and network, and state it against the recovery case rather than steady state. Monitor OSD host CPU during the first real recovery on an EC pool — that measurement is the one that tells you whether the host sizing was right, and it is cheap to collect once and expensive to guess at.

Cross-course references

  • Kubernetes: CPU limits that are fine at steady state and throttle badly during startup storms are the same shape
  • Linux: software RAID 6 parity computation has the identical CPU profile