Back to vault

Distributed Systems — CAP Theorem in Practice

Gemini manual_paste · research · Feb 06, 2026 00:28
user ~18 tokens
Help me understand CAP theorem with practical examples. When would I choose CP vs AP?
assistant ~160 tokens
CAP theorem says: during a network partition (P), you must choose between Consistency (C) and Availability (A). **CP systems** — consistency over availability: ZooKeeper, etcd, PostgreSQL. Choose when: financial transactions, inventory, leader election. **AP systems** — availability over consistency: Cassandra, DynamoDB (eventually consistent), DNS, CDNs. Choose when: activity feeds, analytics, shopping carts. **The nuance most people miss:** It's not binary — you choose per-operation, not per-system. A database can be CP for writes and AP for reads.
Total: ~178 tokens