Skip to main content
RunBook Academy

CephXXVI · Erasure Coding Trade-offsErasure Coding Trade-offs

Why EC handles small writes badly

Advanced⏱ ~16 mincephfio

What you'll learn

  • Trace the latency path of a small EC write
  • Compare it numerically against replication
  • Identify workload signatures that rule EC out
  • Apply mitigations where EC is already committed

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

“EC is slow for small writes” is repeated everywhere and rarely quantified. The quantification is what lets you make the decision defensibly, and it is stark enough that once you have seen it, the guidance stops being folklore.

The latency path

Replicated size 3, 4 KiB write:

client → primary            (one hop)
primary → 2 replicas        (parallel, one hop)
replicas commit             (device latency)
replicas → primary          (one hop)
primary → client            (one hop)

Two round trips. Device latency of the slowest of three.

EC 4+2, 4 KiB misaligned write:

client → primary                      (one hop)
primary → k−1 OSDs: READ stripe       (one hop)
those OSDs read                       (device latency)
OSDs → primary                        (one hop)
primary: merge and encode             (CPU)
primary → affected OSDs: WRITE        (one hop)
OSDs commit                           (device latency)
OSDs → primary                        (one hop)
primary → client                      (one hop)

Four round trips, two device-latency phases in sequence, and the slowest of six OSDs in each phase. On spinning disks, where a device access is several milliseconds, this is the difference between roughly 10 ms and roughly 30 ms — before any queueing.

The workloads it rules out

WorkloadWrite patternEC verdict
Relational database8–16 KiB random, fsync-heavyno
VM OS diskssmall random, metadata-heavyno
Message queue / WALsmall sequential with fsyncno
CephFS metadatasmall omap updatesnot supported
Backup targetslarge sequentialyes
Media archiveslarge write-onceyes
Container registrymedium write-onceyes

Measuring it yourself

fio --name=ecrand --ioengine=rbd --pool=ec-rbd-data \
    --rbdname=testvol --rw=randwrite --bs=8k \
    --iodepth=32 --numjobs=4 --runtime=300 --time_based \
    --percentile_list=50:95:99:99.9

Compare against the same run on a replicated pool. Look at the p99 and p99.9 columns, not the mean — the mean hides the queueing that develops when each operation occupies six devices instead of three.

Mitigations when EC is already in place

  • Align the application. Match write size to the stripe where the application allows it.
  • Reduce stripe_unit so more writes are full-stripe. Costs metadata.
  • Put the hot subset on replication. A replicated pool for the database volumes and EC for everything else is usually the right answer.
  • Add a cache tier — but note that cache tiering is deprecated in current Ceph and should not be used for new deployments.

Quiz

Knowledge check · 4 questions

  1. Q1. How many network round trips does a misaligned small write take on an EC pool, compared with a replicated pool?

  2. Q2. An application that fsyncs after every small write is a poor candidate for EC storage.

  3. Q3. Advise on an EC proposal for a database platform.

    A team wants to consolidate a 40 TB PostgreSQL estate onto an EC 8+3 pool to save capacity. They have benchmarked sequential throughput at 3 GB/s and consider the case proven. The databases do heavy 8 KiB random writes with synchronous commit enabled.

  4. Q4. Why does EC small-write performance degrade more sharply under load than replicated performance?

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

Production discipline

Benchmark with the application’s real block size, queue depth, and sync behaviour before any EC commitment, and report percentiles rather than means. Where EC is already deployed under an unsuitable workload, splitting the hot subset onto replication is almost always more effective than tuning, and it is a change you can make incrementally.

Cross-course references

  • Kubernetes: separating StorageClasses by workload profile is exactly this decision made once at provisioning
  • Linux: the standard advice against databases on RAID 5 rests on the same arithmetic