Course contentsShow
← System Design
Lesson 1362 of 1,91934. Data Replication StrategiesFree lesson

Chain Replication

A replication mode where writes flow through a chain of replicas, providing strong consistency with good throughput.

Chain Replication

What you'll learn: How chain replication orders replicas in sequence to achieve strong consistency while maintaining high throughput for reads and writes.

The Core Idea

Chain replication arranges data replicas in a linear chain rather than a traditional primary-secondary model. Writes flow through the chain from head to tail, with each replica forwarding the write to the next. Reads come from the tail only. This simple design provides strong consistency guarantees while spreading the workload.

How It Works

Imagine a chain with three replicas: A → B → C.

  1. Writes: A client sends a write to the head (A). A applies it, forwards to B. B applies it, forwards to C (the tail). Only when C applies the write does it acknowledge back to the client.

  2. Reads: All reads go to the tail (C). Since C only acknowledges writes after applying them, every read sees consistent, fully-replicated data.

  3. Failures: If a middle replica fails, the chain reconnects around it (A → C). If the head fails, the next replica becomes the new head. If the tail fails, the previous replica becomes the new tail.

Why It's Useful

Chain replication offers a sweet spot between consistency and performance:

  • Strong consistency: The tail only serves reads after writes complete the full chain
  • High read throughput: The tail can handle many concurrent reads without coordinating with other replicas
  • Predictable latency: Write latency = sum of sequential hops, but no quorum coordination overhead
  • Simple reasoning: The linear structure makes it easier to reason about ordering and consistency

Think of it like an assembly line where every station must complete its work before the product reaches customers. Quality is guaranteed, and the final station can handle many inspections simultaneously.

Key Takeaway: Chain replication trades write latency (sequential forwarding) for strong consistency and excellent read scalability from the tail, making it ideal for read-heavy workloads that demand consistency.