cap twelve years later
play

CAP Twelve Years Later: How the Rules Have Changed Presenters: - - PowerPoint PPT Presentation

CAP Twelve Years Later: How the Rules Have Changed Presenters: - Ayushi Bansal - Krithiga Murugavel Brewer, Eric. (2012). CAP Twelve years later: How the "Rules" have Changed. Computer. 45. 23-29. 10.1109/MC.2012.37. Outline


  1. CAP Twelve Years Later: How the “Rules” Have Changed Presenters: - Ayushi Bansal - Krithiga Murugavel Brewer, Eric. (2012). CAP Twelve years later: How the "Rules" have Changed. Computer. 45. 23-29. 10.1109/MC.2012.37.

  2. Outline CAP Theorem ● ACID vs CAP ● Why 2 of 3 misleading? ● CAP confusion ● Managing Partition ● Partition Recovery ●

  3. CAP Consistency Availability Partition Tolerance Every read receives the A guarantee that every The system continues to most recent write or an request receives a operate despite an error. response. arbitrary number of messages being dropped (or delayed) by the network between nodes

  4. Writing to a Server https://mwhittaker.github.io/blog/an_illustrated_proof_of_the_cap_theorem/

  5. Reading from a Server

  6. An Inconsistent System 1 2 3 4 5

  7. A Consistent System 1 2 3 4 5 6 7 8

  8. Partition

  9. CAP THEOREM Any networked shared-data system can have at most two of three desirable properties . https://www.easttexassoftware.com/post/cap-theorem-and-distributed-systems

  10. Choosing A over C

  11. Hence proved that we cannot have both Consistency, Availability and Partition Tolerance .

  12. Alice Bob ACID 150 50 Isolation Atomicity Consistent Alice Bob Alice Bob Alice Bob Mac 150 50 150 50 150 50 100 50 150 50 100 150 100 Revert Transaction 100 100 50

  13. ACID VS CAP Consistency in C AP refers to Single copy consistency and Consistency in A C ID means the ● transaction preserves all the database rules A stands for Atomicity in ACID and Availability in CAP. ● ACID CAP Alice Bob A A 10 40 5 5 5 10 5 40 ACID Inconsistency Integrity constraint: A+B = 50 CAP Inconsistency

  14. Why is 2 of 3 misleading? Partition are Rare ● Granularity in making choice between C and A based on: ● ❏ Applications ❏ Users Involved ❏ Data All three properties are more continuous than binary ●

  15. CAP Confusion Hidden cost of forfeiting consistency. ● Can a designer choose not to have partitions? ● When User cannot reach the service at all there is no choice ● between C and A except when part of the service runs on the client.

  16. CAP-LATENCY CONNECTION Latency: The delay from input into the system to desired outcome High Availability A B Data Replication A B A B A B Yahoo PNUTS Facebook Consistency vs Latency Higher inconsistency Low inconsistency ● ● Low latency High latency ● ●

  17. PARTITION MODE Detect Partition ● Enter partition Mode, and decide between Consistency and Availability ● Recover process to restore consistency and compensate for mistake ●

  18. THE PARTITION DECISION After Entering Partition Mode Decision made based on the invariants. ● For invariants that needs to be maintained, ● the system prohibits or modifies the operation. Eg: Credit Card transaction. Record Extra Limit operations that Suggests to build a Crosstable of ● information on leads to reduced operations and invariants. operations and use availability later for recovery

  19. Partition Recovery Two goals State on both sides must become consistent ● Handle the mistakes done during partition mode ● Undo the mistakes ○ Compensate for mistakes ○

  20. Version Vectors Best way to track history on both sides of partitions. ● Captures causal dependencies among operations ● Vector A Vector B Vector A Vector B (1,12) (1,12) (1,12) (1,12) (2,14) (2,14) ( 2,14) (2,14) (3,16) (3,15 ) (3,15) (3,15) Vector A is newer Cannot determine order, than Vector B updates concurrent , possibly inconsistent

  21. Partition Recovery Concurrent Version System (CVS) - uses version vector ● Merge conflicts ● Manual merging - offline wiki system ○ Automatic merging - Google Docs ○ Commutative Replicated Data types (CRDTs) ● Merge concurrent modifications, always, in any order. ○ Rearrange operations into a preferred consistent global order ○

  22. Partition Recovery - AMAZON Carts After Partition Recovery During Partition Before Partition 1 2 3 4 1 4 3 5 2 1 2 3 3,2 1 2 4 5 1 5 3

  23. Compensation in an ATM Key invariant: Balance should be zero or ● higher Essential operations: Deposit, Withdraw ● (violate invariant) and Check balance Availability preferred over Consistency ● Withdraw limit - bounds risk ○ Compensation - Extra fee and ○ repayment of money Check Kiting ●

  24. Check of $5000 $0 $5000 $1000 $-4000 Check Kiting Withdraw Repeat $3000 cycle $-3000 $2000 $1000 $-4000 Check of $5000

  25. THANK YOU !!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend