The choice this lab shows

Two regions each hold a copy of one balance. When the link between them breaks, called a partition, each region must choose.

  • CP: refuse writes until the link is back. Both copies stay the same, and users see errors.
  • AP: keep taking writes on both sides. Users see no errors, but the copies differ. When the link heals, one side's writes can be lost.
  • Read-Your-Writes is not a third CAP choice. It runs on top of AP, and sends your reads to the region that holds your own last write.

Step through one partition

Two regions hold one balance of $100. The link between them breaks, two users each make a deposit, and User 1 checks their balance. Pick a choice, then press Next step. Back takes you to the step before.

When a region is cut off

With this choice: Both deposits were taken, but User 1 read $120 without their own deposit. When the link came back, last-writer-wins kept $120 and lost the $50.

User 1, near US-EastUser 1near US-EastUser 2, near EU-WestUser 2near EU-WestUS-East, user:balance, NOWUS-Eastuser:balancecut offNOWEU-West, user:balanceEU-Westuser:balancecut off
  • User 1 — near US-East — healthy
  • User 2 — near EU-West — healthy
  • US-East — user:balance — healthy — NOW — cut off
  • EU-West — user:balance — healthy — cut off
  • Copy between regions
  • Deposit
  • Answer
Step 1 of 5

Step 1 of 5 · US-East

Failed: The link between the regions breaks

What happens
Both regions still run and still hold $100, but they cannot reach each other.
Why
This is a partition: the network splits, and each side keeps working alone.
What changes
Each region must now choose what to do with writes.
Next
US-East takes User 1's $50 deposit

Event log

4 more to go. Press a line to go back to that step.

US-East holds
$100
same as EU-West
EU-West holds
$100
same as US-East
The link
down
Watch: no copies cross

Step 1 of 5: US-East. The link between the regions breaks. Both regions still run and still hold $100, but they cannot reach each other.

What this simplifies. This run uses two regions, one key and a stated order of events. Real systems often use three or more sites, so a majority can keep taking writes. Many also merge both changes instead of dropping one.

Try it yourself

Press "Trigger Network Partition", make deposits in both regions, then press "Read my balance" and heal the link.

Choice:
Region A (US-East)
Primary Data Center
KEY: user:balance
$100
Version: v1
Region B (EU-West)
Secondary Data Center
KEY: user:balance
$100
Version: v1
Read your own balance

You made the deposits above. Your next read goes to the other region, as if your phone switched networks.

Replication & Consensus Log
No transactions recorded yet. Click deposit or trigger partition above.