Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CAP Revisited

CAP Revisited

Diving into the theory behind the CAP theorem and discussing implications for database systems.

Philipp Krenn

April 27, 2015
Tweet

More Decks by Philipp Krenn

Other Decks in Programming

Transcript

  1. Consistency "[...] a total order on all operations such that

    each operation looks as if it were completed at a single instant."
  2. Availability "[...] every request received by a non- failing node

    in the system must result in a response."
  3. Partition Tolerance "In order to model partition tolerance, the network

    will be allowed to lose arbitrarily many messages sent from one node to another."
  4. Proof by Construction If a client writes to one side

    of a partition, any reads that go to the other side of that partition cannot know about this write
  5. Conclusion "most real-world systems today are forced to settle with

    returning “most of the data, most of the time.”"
  6. 4 you pushed the actual problem to another layer of

    the system 4 you are not, in fact, designing a distributed system 4 latency is a thing that exists 4 using "infinite timeouts" is not an acceptable solution to lost messages 4 read-only mode is still unavailability for writes 4 you shouldn't be in charge of people's data
  7. Consistency Predicate: Integrity constraint History: Total order / single copy

    Increment / decrement counter consistency: ACID !, CAP ❓
  8. Repeating for the 4th time today, fsync is not required

    for strong consistency, this post saying so is wrong http://antirez.com/news/67 1 https://twitter.com/kellabyte/status/410224523602960385
  9. "some systems may sacrifice both consistency and availability! In doing

    so they may achieve a trade-off better suited for the application at hand."
  10. "CAP prohibits only a tiny part of the design space:

    perfect availability and consistency in the presence of partitions, which are rare."
  11. Dirty Read Isolation: Read uncommitted Readable from (minority) primary while

    async replication is running — network partition with rollback after a timeout
  12. /dev/null breaks CAP: effect of write are always consistent, it's

    always available, and all replicas are consistent even during partitions. 1 https://twitter.com/ashic/status/591511683987701760
  13. Images 4 Bad Neighbors 4 CAP: http://berb.github.io/diploma-thesis/community/ 061_challenge.html 4 Robinson

    Crusoe: https://flic.kr/p/8rbnLQ 4 Perpetuum mobile: https://flic.kr/p/5VvSJ8 4 Lemon: https://flic.kr/p/5wviJe 4 Carly Rae Jepsen: Call me maybe 4 Dirty & stale read: https://aphyr.com/posts/322-call-me-maybe- mongodb-stale-reads