[ SRE_ARENA ]
CAP & PACELC THEOREMS

You Cannot Defy Physics.

Visualization: 1. The CAP Theorem (During a Disaster)
DOWNLOADING CONCEPT: 1. THE CAP THEOREM (DURING A DISASTER)...

↳CAP = Consistency, Availability, Partition Tolerance.

  • ↳Here is the harsh truth: You don't get to choose P. Network cables get cut.
  • ↳Switches fail.
  • ↳Packets drop.
  • ↳A network partition WILL happen.
  • ↳Therefore, when the network breaks, you must choose: - CP (Consistency): You guarantee that everyone sees the exact same data.
  • ↳If the network is broken and Node A can't talk to Node B, Node A must refuse to answer queries (Availability is sacrificed).
  • ↳Example: etcd, Zookeeper.
  • ↳If they lose quorum, they stop working to protect data integrity.
  • ↳- AP (Availability): Node A answers the query using the data it currently has, even if it knows it can't reach Node B to get the latest updates (Consistency is sacrificed).
  • ↳Example: Cassandra.
  • ↳It stays up, but you might read stale data.
▲ LIVE INCIDENTA shopping cart microservice is using a strict CP database. During a brief network blip, users couldn't add items to their carts.
sre@arena:~/cap-pacelc
sre@arena:~$ grep 'Timeout' /var/log/cart-service.log | wc -l