DISTRIBUTED SYSTEMS / SYSTEM CONCEPT BRIEF

Partition tolerance

Partition tolerance is a system's ability to keep operating correctly when the network between its nodes drops or delays messages, splitting the cluster into groups that cannot talk to each other.

IntermediatePhase 05 / Topic 4 of 17RequirementsTrade-offsFailure modes
01

Overview

Partition tolerance is a system's ability to keep operating correctly when the network between its nodes drops or delays messages, splitting the cluster into groups that cannot talk to each other. In real networks partitions do happen: switch failures, misconfigured firewalls, cloud network issues, or long garbage collection pauses that look like a dead node.

Because partitions cannot be prevented, any distributed system must decide what to do during one: refuse some requests to stay consistent (CP), or keep answering with possibly stale or conflicting data (AP). This is the practical meaning of the CAP theorem. Designing for partitions includes timeouts, quorum rules, fencing, and conflict resolution.

Two bank branches when the phone line is cut

If branches cannot call each other, they can either stop withdrawals until the line is back (consistent but unavailable) or keep serving customers and reconcile later, risking an overdraft (available but inconsistent).

02

When to use it

  • Any system with more than one node communicating over a network.
  • Choosing between CP and AP behavior for each feature.
  • Designing multi-region deployments.
  • Explaining failure scenarios in interviews.
03

Where it shows up in interviews

CP vs AP choice

Recognize it when: what happens if regions cannot communicate?

  • Design a global inventory system
  • Design a shopping cart
Failure scenarios

Recognize it when: interviewer asks what happens when the network splits.

  • Design a distributed lock service
  • Design a key-value store
04

Where it is used in real software

Jepsen

Kyle Kingsbury's Jepsen tests inject network partitions into databases and have found consistency bugs in many popular systems.

Dynamo shopping cart

Amazon chose availability: carts accept writes during partitions and merge divergent versions afterward.

etcd and ZooKeeper

Choose consistency: the minority side of a partition stops accepting writes.

05

Key terms

Network partition
Nodes are split into groups that cannot communicate.
CP system
Stays consistent during partitions by rejecting some requests.
AP system
Stays available during partitions and reconciles later.
Majority quorum
Only the side with more than half the nodes can make progress.
Conflict resolution
Merging divergent writes after a partition heals.
06

How it works, step by step

  1. 1
    Detect the partition

    Heartbeats and timeouts; you cannot distinguish slow from dead.

  2. 2
    Apply the chosen policy

    CP: minority stops writes. AP: every side keeps accepting.

  3. 3
    Protect against split brain

    Majority quorums and fencing tokens.

  4. 4
    Heal

    Nodes reconnect and exchange missed updates.

  5. 5
    Resolve conflicts

    Last-write-wins, vector clocks, CRDTs, or application merges.

A 5-node cluster partitioned 3 / 2
Step 1 / 4
Node 1
Node 2
Node 3
Node 4
Node 5

STEP 1Healthy cluster: all five nodes replicate to each other.

07

CP vs AP behavior during a partition

Same partition, different choices

Step 1 / 4
FeatureChoiceBehavior during partition
Bank balanceCPMinority side rejects withdrawals
Shopping cartAPBoth sides accept adds; merge carts later
Leader electionCPOnly majority side can elect a leader
Social likesAPCount increments locally, reconcile later

NOWFeature: Bank balance | Choice: CP | Behavior during partition: Minority side rejects withdrawals

Partition tolerance is not optional; the real decision is what each feature sacrifices while the partition lasts.

08

Implementation

// A node accepts writes only if it can reach a majority (CP behavior)async function write(key: string, value: string, peers: Peer[]) {  const clusterSize = peers.length + 1;  const majority = Math.floor(clusterSize / 2) + 1;  const acks = await Promise.allSettled(peers.map((p) => withTimeout(p.replicate(key, value), 200)));  const ok = 1 + acks.filter((a) => a.status === "fulfilled").length; // count self  if (ok < majority) {    throw new Error("Not enough replicas reachable: refusing write to stay consistent");  }  return { committed: true, replicas: ok };}
09

Complexity and performance

Majority neededfloor(n / 2) + 1

5 nodes tolerate 2 failures.

Partition detection~timeout duration

Trade-off: fast vs false positives.

10

Trade-offs

Short vs long timeouts

Short timeouts detect failures quickly but misclassify slow nodes as dead; long ones delay recovery.

CP vs AP

CP protects invariants but turns partitions into outages for some users; AP keeps serving but requires reconciliation logic.

11

Variants and related techniques

PACELC

Else (no partition), systems still choose between latency and consistency.

Per-operation choice

Cassandra and DynamoDB let each request pick its consistency level.

12

Common mistakes

  • Assuming partitions are rare enough to ignore.

    Fix: Design and test the partition behavior explicitly.

  • Even-numbered clusters.

    Fix: A 2/2 split leaves no majority; use odd sizes like 3 or 5.

13

Interview questions

Why can't a distributed system give up partition tolerance?

Networks will eventually drop or delay messages. A system that is not partition tolerant simply behaves incorrectly when that happens, so the real choice is between consistency and availability during partitions.

How does a majority quorum prevent split brain?

Only one side of a partition can contain more than half the nodes, so at most one side can elect a leader or commit writes.

14

Practice problems

ProblemDifficultyWhat it trains
Describe CP and AP behavior for 5 featuresEasyTrade-offs.
Design partition handling for a multi-region cartHardMerge strategy.