Lesson 12 of 17
16. Consistency and CAP

Memory card and where the analogy breaks

3 min read+10 XP

The memory card (tear this page out)

#QuestionMemory code
16.1Two meanings of consistent?ACID's C keeps the rules; CAP's C keeps the copies agreeing
16.2Strong consistency?Many counters, one ledger
16.3Eventual consistency?Couriers arrive eventually; until then, branches may disagree
16.4Session guarantees?Show me my own deposit, never go back in time, and never show the answer before the question
16.5Partition?A cut line and a slow line look the same from your side
16.6CAP?When the line is cut, refuse or risk: you can't promise both right and always
16.7CP vs AP?CP says sorry; AP says maybe
16.8PACELC?On bad days, choose answer or accuracy; on good days, choose speed or accuracy
16.9Quorums?Ask enough counters that the asking and the telling must overlap
16.10Per feature?Price the stale answer and the missing answer; pick per feature

The whole chapter in one line: When copies can't talk, choose sorry or maybe; when they can, choose fast or certain; and choose per feature, not per company.

Where the analogy breaks

  • Clerks can tell when a phone line is dead. Servers can't tell a dead line from a slow one, which is why timeouts and careful defaults matter so much.
  • A bank can call the customer back to fix an overpayment. Software often can't undo a stale decision (a shipped order, a sent email), so choose strong consistency where undoing is hard.
  • Two counters is a small bank. Real systems have dozens of replicas, and "consistent" can mean many precise things in between strong and eventual.

Quick check

Five questions on this chapter. Pick an answer, then check it.

quiz