Course contentsShow
← System Design
Lesson 496 of 1,91914. CAP TheoremFree lesson

Banking and Financial Systems (CP)

Why financial systems prioritize consistency to prevent double-spending and maintain accurate balances.

Banking and Financial Systems (CP)

What You'll Learn

You'll discover why banks and financial systems choose consistency over availability, even if it means rejecting transactions during network failures.

Why Banks Prioritize Consistency (CP)

In the CAP theorem, CP systems sacrifice availability to maintain consistency during network partitions. Banking and financial systems are the quintessential example of CP systems because correctness trumps speed when money is involved.

The Double-Spending Problem

Imagine you have 100inyouraccount.Ifthebankingsystemprioritizedavailability(AP),youmightwithdraw100 in your account. If the banking system prioritized availability (AP), you might withdraw 100 from an ATM in New York while simultaneously withdrawing 100fromanotherATMinLosAngelesduringanetworkpartition.Bothtransactionssucceedbecauseeachpartitiondoesn′tknowabouttheother.You′vejustcreated100 from another ATM in Los Angeles during a network partition. Both transactions succeed because each partition doesn't know about the other. You've just created 100 out of thin air—a catastrophic failure.

In a CP system, the bank refuses one (or both) transactions during the partition. You might get an error message saying "Service temporarily unavailable," but your balance remains accurate. The system prefers to be unavailable rather than incorrect.

Accurate Balances Are Non-Negotiable

Financial regulations and trust require that:

  • Account balances are always correct
  • Transactions never create or destroy money
  • Audit trails are accurate and consistent

If a bank's database showed different balances in different data centers, it would violate regulatory requirements and destroy customer trust. A temporary service outage is annoying; incorrect balances are catastrophic.

Real-World Impact

During network partitions, banking systems may:

  • Reject transactions with "unable to process" errors
  • Route requests to a single consistent partition
  • Use distributed consensus (like Paxos or Raft) to ensure all nodes agree before committing

Key Takeaway: Banking and financial systems choose consistency (CP) because preventing double-spending and maintaining accurate balances is more critical than always being available—money must be correct, even if temporarily inaccessible.