cap theorem

Computer science theorem that quantifies the inevitable trade-offs. Eric Brewer’s CAP theorem says that if you want CAP you have to settle for two out of three.

acronym title description
C consistency/sequential consistency All the replicas are in sync and maintain the same state of any given object at any given point of time. Every node contains same data at the same time. Simply put, performing a read operation will return the value of the most recent write operation causing all nodes to return the same data. A system has consistency if a transaction starts with the system in a consistent state, and ends with the system in a consistent state. In this model, a system can (and does) shift into an inconsistent state during a transaction, but the entire transaction gets rolled back if there is an error during any stage in the process.
A availability A request will eventually complete successfully. A read/write request on any node of the system will never be rejected as long as the particular node is up and running. Every request receives a response indicating success or failure. At least one node must be available to serve data every time.
P partition tolerance (distributed system) will continue to work unless there is a total network failure. A few nodes can fail and the system keeps going. When the network connecting the nodes goes down, the system will still continue to operate even though some/all nodes can NO longer communicate with each other. This condition states that the system continues to run, despite the number of messages being delayed by the network between nodes. A system that is partition-tolerant can sustain any amount of network failure that doesn’t result in a failure of the entire network. Data records are sufficiently replicated across combinations of nodes and networks to keep the system up through intermittent outages. When dealing with modern distributed systems, Partition Tolerance is not an option. It’s a necessity. Hence, we have to trade between Consistency and Availability.

todo

masterX-masterY setup X-Y comm down can’t sync data/updates P is a must either allow out-of-sync: lose C gain A report the system as unavailable: keep C lose A

2pc

  • http://dbmsmusings.blogspot.com/2019/01/its-time-to-move-on-from-two-phase.html
  • https://docs.mongodb.com/v3.4/tutorial/perform-two-phase-commits/
  • https://www.kamilgrzybek.com/design/the-outbox-pattern/
  • https://docs.microsoft.com/en-us/dotnet/architecture/microservices/multi-container-microservice-net-applications/subscribe-events