← Lessons

quiz vs the machine

Gold1350

System Design

Leader Follower Replication

Routing writes through one leader and streaming changes to read only followers.

5 min read · core · beat Gold to climb

The setup

In leader follower replication one node is the leader and the rest are followers. All writes go to the leader, which records each change and streams it to followers over a replication log. Followers apply the same changes in order, so they hold copies of the data.

Reads scale out

Clients can read from any follower, which spreads read traffic across many machines. Writes stay centralized on the leader, keeping a single source of truth for ordering.

Sync versus async

  • Synchronous the leader waits for a follower to confirm before acknowledging the write. Safer but slower and fragile if a follower stalls.
  • Asynchronous the leader acknowledges immediately and ships changes in the background. Fast but a leader crash can lose recent writes.

Most systems use a mix, keeping one follower synchronous for durability.

Replication lag

Followers fall behind the leader, so a client might read stale data right after writing. Read your writes consistency routes a user back to the leader or a fresh replica until their own writes propagate.

Key idea

Leader follower replication centralizes writes on one leader and scales reads across followers while trading durability against latency in the sync mode.

Check yourself

Answer to earn rating on the learn ladder.

1. Where do writes go in leader follower replication?

2. What is the risk of fully asynchronous replication?

3. What technique helps a user avoid reading their own stale data?