CAP Theorem

  • A theory saying that any distributed database can only have 2/3 of the following (between Consistency and Availability):

    • Consistency (same as ACID)
    • Availability
      • every request is success without guarantee it has the most recent write
    • Partition tolerance
      • System continue to operate despite a number of messages being delayed
  • Pasted image 20220930163334.png

  • Proof

    • For example if network error happens, we have the following options
      • Cancel the operation to ensure consistency but decrease availability
      • Process with the operation which ensure availability but risk consistency
  • https://www.youtube.com/watch?v=k-Yaq8AHlFA

  • Database/SQL follow ACID which guarantee consistency wheras NoSQL follows BASE choosing availability over consistency

  • However with modern day, PACELC theorem system is a better reflection of distributed computing