Data Council — System Design

Choose how many elders to tell and to ask at the Balai Desa: 18 levels of replication, quorums (R+W>N), the CAP theorem and consistency models.

What you learn in this game

Picture the data copied to N elders. A write counts once W elders record it; a read asks R elders and uses the newest page it finds. When R + W > N, the elders asked and the elders told always share at least one person, so a read always sees the last write (strong consistency). When R + W ≤ N, a read can miss that write: stale.

When the network partitions, some elders can't be reached. Every op needs its quorum from those still reachable: if W (or R) is larger than that, the op fails (unavailable). This is the heart of CAP: during a partition you trade consistency or availability.

The R + W > N rule holds for any N. A bigger cluster needs bigger quorums to stay consistent. For N = 5, a majority (3) write and a majority (3) read always overlap: 3 + 3 = 6 > 5.

The key is the majority quorum. As long as a majority of elders can still be reached, majority write and read quorums (3 of 5) can still be met AND overlap (3 + 3 > 5): the majority side stays consistent and available, the minority side stops. That is why consensus systems like odd numbers.

The far end of the spectrum: W = 1, R = 1 is as fast as it gets (one elder only), but R + W = 2 does not exceed N = 3, so a read can be stale until the other copies catch up (eventual consistency). Many real systems choose this for speed, then rely on anti-entropy or gossip to bring the copies together.

What the levels ask

  1. Set W and R so a buyer never gets a stale price.
  2. Pick W and R small enough that nobody waits more than 20 ms.
  3. Set W and R so no write or question fails while she is out.
  4. Find the one pair of W and R that is consistent and fast enough.
  5. The rule stays R + W > N. Find W and R for five elders.
  6. Set W and R so nothing fails while she is out.
  7. Find W and R that overlap (R + W > 5) with no more than three visits.
  8. Pick small quorums for speed.
  9. Three of five is still a majority. Find W and R that pass while they are out.
  10. The rule R + W > N for N = 4, an even number. Find W and R.
  11. Only two are in, a minority. To keep serving, the quorums must be small and consistency is given up.
  12. 40 ms leaves room to be uneven. Shift the load between writes and questions, as long as R + W > 5.

And more, 18 levels in all.