LESSON 06 · Choosing a model

Choose among leaders and quorums

Leaderless quorums remove failover, and the choice among the three models comes down to what concurrent writes mean for your data.

SYSTEM VIEW

The replication path

Diagram view
Model—
Failovers—
Lost writes—

Watch sensor readings land on three replicas with no leader, then see what that gives, what it costs, and when to choose it.

  1. No replica leads. Sensor 17 sends its 12:00:05 reading, and the coordinator sends it to all three replicas (N = 3). It answers after the fastest two acks (W = 2), in 3 ms, so slow Replica 3’s 40 ms doesn’t hold it up.

    N
    3 replicas
    W
    2 acks

    What changed

    • 12:00:05 on Replicas 1 and 2
    • Answered after 2 of 3 acks
    • Replica 3 still writing
  2. A moment later, before Replica 3 finishes, the dashboard asks for sensor 17’s latest reading. The coordinator asks two replicas (R = 2): Replica 3 still returns 12:00:00 and Replica 2 returns 12:00:05, so it keeps the newer. Any two of three include one that took the write.

    R
    2 replies
    W + R
    2 + 2 > 3

    What changed

    • Dashboard
    • Read from Replicas 2 and 3
    • The newer reading wins
  3. Replica 3 dies before it finishes writing 12:00:05. The 12:00:10 reading still goes to all three; Replicas 1 and 2 ack, and the coordinator answers as before. There is no leader to replace, so nobody is promoted and no write pauses.

    What changed

    • Replica 3 down
    • 12:00:10 on Replicas 1 and 2
    • No promotion, no pause
  4. Replica 3 comes back still holding 12:00:00. Nothing waited for it: repair copies the two readings it missed, 12:00:05 and 12:00:10, from Replica 2, and all three hold the same readings again.

    What changed

    • Replica 3 back
    • 12:00:05 and 12:00:10 repaired
  5. Two operators set sensor 17’s alert limit a millisecond apart, to 30 and then 35, and both are told OK. The coordinator forwards each as it arrives, and the network delivers them in different orders: Replicas 1 and 3 end on 35, Replica 2 on 30.

    What changed

    • limit = 30, then limit = 35
    • Replica 2 disagrees
  6. A rule has to settle it. Last-write-wins keeps 35, stamped a moment later, on every replica, and 30 vanishes, though its operator was told it saved.

    Rule
    last-write-wins
    Kept
    limit = 35

    What changed

    • All three on limit = 35
    • limit = 30, told OK, then lost
  7. Ask what two writes to one item should do. Seat bookings must refuse one: a single leader orders them and checks uniqueness, the right default. Profiles edited in two regions avoid conflicts with a home region per user: multiple leaders. Sensor readings keyed by device and time never collide: leaderless. Try each workload.

    Workload

Space plays · ← → step · Home resets

THE IDEA

How it works

Leaderless replication removes the ordering node altogether. A client, or a coordinator acting for it, sends each write to several replicas and reads from several. Cassandra and Riak work this way. The mechanics of N, W, R, quorum overlap, sibling versions, and repair are in the Key-Value Store chapter, so this lesson covers where the model fits.

Its main gift is the absence of failover. With N = 3, W = 2, R = 2, one replica can die and nobody gets promoted: requests carry on with the other two, and the returning node is repaired later. Waiting for the fastest two of three also hides one slow node from latency. What you give up is a single order. Overlapping quorums make fresh reads likely, but concurrent writes to one key still need a rule, and last-write-wins discards data. Multi-row transactions and uniqueness checks do not come naturally either.

To choose, ask what should happen if two writes touch the same item at once. If one must be refused, use a single leader: seat reservations, ledgers, and most business data belong here, and it is the right default because transactions and constraints work as expected. If writers must be in separate places and conflicts can be merged or avoided, use multiple leaders: an offline notes app, or profiles edited from two regions with a home region for each user. If keys rarely collide and writes must continue through node loss, consider leaderless: sensor readings keyed by device and timestamp cannot conflict, and a lost node must not pause ingestion.

DECISION POINT

A delivery company needs storage for GPS pings from 200,000 vehicles, each sending one every 5 seconds, and for its customer billing ledger. A team proposes one replication model for both to keep operations simple. What would you recommend?

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

Keep in mind

  • Quorums remove failover: a node can die without anyone being promoted.
  • Overlapping quorums make fresh reads likely but do not order concurrent writes.
  • Start with one leader, and move only when writes must land in many places or never pause.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 3
ApplyQUESTION 01

A strict-quorum store uses N = 3, W = 3, R = 1. One replica is down for maintenance. What do clients see?

Choose an answer. You’ll see the explanation once you get it right.

0 of 3 checkpoints answered correctly to complete this lesson.