TechPrep
The trade-offsReadPracticeCheck

Replication, partitioning and consistency

Copies buy availability and read scale, partitions buy write scale, and both cost you some form of consistency.

Replication

Single-leader replication is the default: one writer, followers for reads and failover. Synchronous followers protect against data loss at the cost of write latency; asynchronous ones are fast but can lose the last few writes on failover. Multi-leader and leaderless (quorum) designs accept writes in several places and must resolve conflicts, which is a product decision as much as a technical one.

Partitioning

Partition by a key that spreads load and keeps related data together. Hash partitioning spreads load but kills range scans; range partitioning keeps scans but invites hot spots on monotonically increasing keys like timestamps. The partition key is usually the most expensive decision in the design to reverse; say so.

Consistency, in the words interviewers use

GuaranteeMeansTypical cost
LinearisableEvery read sees the latest write, as if there were one copyCoordination on every write; unavailable during some partitions (CAP)
Read-your-writesA user sees their own updatesRoute the user's reads to the leader or a caught-up replica for a while
Monotonic readsA user never sees time go backwardsSticky routing to one replica
EventualReplicas converge if writes stopCheap; the application must tolerate stale reads

PACELC is the more useful framing than CAP alone: under a Partition choose Availability or Consistency; Else, choose Latency or Consistency. Most real trade-offs are in the "else" branch.

Staff move: map each user-facing flow to the weakest guarantee it can tolerate. "Balances need linearisable writes; the activity feed is fine with eventual." Mixed guarantees in one system are normal and expected.

Practice

Written for this site to drill the lesson. Not reported interview questions.

  1. A global SaaS product must keep EU customer data in the EU. Sketch the partitioning and replication scheme and what happens to a user who travels.
  2. Explain why a timestamp is a poor partition key for an events table and propose two alternatives.
  3. Design the read path for a profile page that must show a user their own edits immediately but can show other users' edits a few seconds late.

Check yourself

What does PACELC add to CAP?

Even without a partition, you trade latency against consistency.

Why is the partition key a high-stakes decision?

It decides load spread and which operations stay local, and changing it means re-partitioning all the data.

Saved in this browser.