CephXXIII · ReplicationReplication
How a replicated write actually completes
What you'll learn
- Trace a write from client through primary to replicas
- Explain why the client waits for all replicas, not a quorum
- Identify which network hop contributes which latency
- Predict the effect of one slow replica on client write latency
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
Write latency on a replicated pool is not the latency of your fastest
disk, or your average disk. It is the latency of the slowest OSD in the
acting set, plus two network hops. Once you have internalised that, a
whole category of performance mystery — “why is the cluster slow when
ceph osd perf shows only one bad OSD?” — becomes obvious.
The path
sequenceDiagram
participant C as Client (librados)
participant P as Primary OSD
participant R1 as Replica OSD
participant R2 as Replica OSD
C->>P: write object
P->>R1: replicate
P->>R2: replicate
R1-->>P: ack (committed)
R2-->>P: ack (committed)
P-->>C: ack (committed)
- The client computes the PG from the object name and looks up the acting set in its cached OSD map. No monitor is involved — the client contacts the primary OSD directly.
- The primary writes locally and simultaneously sends the operation to every replica.
- Each replica writes durably and acknowledges.
- Only when all replicas have acknowledged does the primary acknowledge to the client.
Why all, not a quorum
Ceph is not a quorum-write system. Every OSD in the acting set must commit before the client is told the write succeeded. The reason is that Ceph promises strong consistency: any subsequent read, from any client, returns that write. A quorum write would leave a replica behind, and serving a read from a lagging replica would break that promise.
The cost is that write latency is bounded below by the slowest replica. The benefit is that you never reason about read-your-writes anomalies — a category of bug that is genuinely hard to debug in production.
Where the latency comes from
| Stage | Contribution |
|---|---|
| client → primary | one network hop, public network |
| primary local write | device commit latency |
| primary → replicas | one network hop, cluster network |
| replica local write | device commit latency (slowest wins) |
| replicas → primary | return hop |
| primary → client | return hop |
Two round trips and the maximum of three device commits. On all-flash with a 25 Gb network that is well under a millisecond; on spinning disks it is dominated entirely by the device term.
Quiz
Knowledge check · 4 questions
Q1. On a size-3 pool, when does the primary OSD acknowledge a write to the client?
Q2. A client contacts a monitor to find out which OSD to send each write to.
Q3. Explain a cluster-wide latency increase from a single device.
Users report that write latency across an entire RBD pool has roughly tripled. `ceph -s` is HEALTH_OK. `ceph osd perf` shows osd.31 at 240 ms commit latency; every other OSD is under 8 ms. The cluster has 96 OSDs.
Q4. Why does Ceph require all replicas to commit rather than a quorum, given the latency cost?
Passing score: 75%. Answers are checked in this browser.
Production discipline
Monitor per-OSD latency as a distribution with outlier alerting, not as a cluster average — the average hides exactly the condition that hurts most. When investigating a pool-wide latency complaint, check for a single outlier before you consider capacity, network, or tuning; it is the most common cause and the fastest to confirm.
Cross-course references
- Kubernetes: a single slow node in a StatefulSet quorum has the same disproportionate effect
- Linux: synchronous replication in DRBD or a synchronous NFS mount shares the slowest-link property