Causal Consistency in Distributed Systems

causal consistency n.w
1 / 39
Embed
Share

Explore the concept of Causal Consistency in Distributed Systems through lectures on consistency models, logical clocks, and practical applications. Learn how writes are ordered, concurrent operations are handled, and the role of physical time.

  • Causal Consistency
  • Distributed Systems
  • Consistency Models
  • Logical Clocks
  • Physical Time

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Causal Consistency COS 418: Distributed Systems Lecture 14 Michael Freedman

  2. Consistency models Causal Linearizability Eventual Sequential 2

  3. Recall use of logical clocks (lec 4) Lamport clocks: C(a) < C(z) Conclusion: None Vector clocks: V(a) < V(z) Conclusion: a z Distributed bulletin board application Each post gets sent to all other users Consistency goal: No user to see reply before the corresponding original message post Conclusion: Deliver message only after all messages that causally precede it have been delivered 3

  4. Causal Consistency 1. Writes that are potentially causally related must be seen by all machines in same order. 2. Concurrent writes may be seen in a different order on different machines. Concurrent: Ops not causally related

  5. Causal Consistency 1. Writes that are potentially causally related must be seen by all machines in same order. P1 P3 P2 a b f c 2. Concurrent writes may be seen in a different order on different machines. d e g Concurrent: Ops not causally related Physical time

  6. Causal Consistency P1 P3 P2 Operations Concurrent? a b a, b N f b, f Y c c, f Y d e, f Y e e, g N g a, c Y a, e N Physical time

  7. Causal Consistency P1 P3 P2 Operations Concurrent? a b a, b N f b, f Y c c, f Y d e, f Y e e, g N g a, c Y a, e N Physical time

  8. Causal Consistency: Quiz Valid under causal consistency Why? W(x)b and W(x)c are concurrent So all processes don t (need to) see them in same order P3 and P4 read the values a and b in order as potentially causally related. No causality for c .

  9. Sequential Consistency: Quiz Invalid under sequential consistency Why? P3 and P4 see b and c in different order But fine for causal consistency B and C are not causually dependent Write after write has no dep s, write after read does

  10. Causal Consistency x A: Violation: W(x)b is potentially dep on W(x)a B: Correct. P2 doesn t read value of a before W

  11. Causal consistency within replication systems 11

  12. Implications of laziness on consistency shl Consensus Module State Machine Consensus Module State Machine Consensus Module State Machine Log Log Log add jmp mov shl add jmp mov shl add jmp mov shl Linearizability / sequential: Eager replication Trades off low-latency for consistency 12

  13. Implications of laziness on consistency shl State Machine State Machine State Machine Log Log Log add jmp mov shl add jmp mov shl add jmp mov shl Causal consistency: Lazy replication Trades off consistency for low-latency Maintain local ordering when replicating Operations may be lost if failure before replication 13

  14. Don't Settle for Eventual: Scalable Causal Consistency for Wide-Area Storage with COPS W. Lloyd, M. Freedman, M. Kaminsky, D. Andersen SOSP 2011 14

  15. Wide-Area Storage: Serve reqs quickly

  16. Inside the Datacenter Web Tier Storage Tier A-F Remote DC G-L Web Tier Storage Tier A-F G-L M-R M-R S-Z S-Z

  17. Trade-offs Consistency (Stronger) Partition Tolerance vs. Availability Low Latency Partition Tolerance Scalability

  18. Scalability through partitioning A-Z A-L A-F A-C A-Z A-L A-F A-C M-Z G-L D-F M-Z G-L D-F M-R G-J M-R G-J S-Z K-L S-Z K-L M-O M-O P-S P-S T-V T-V W-Z W-Z

  19. Causality By Example Causality ( ) Thread-of-Execution Gets-From Transitivity Friends Remove boss from friends group Boss Post to friends: Time for a new job! New Job! Friend reads post

  20. Previous Causal Systems Bayou 94, TACT 00, PRACTI 06 Log-exchange based Log is single serialization point Implicitly captures and enforces causal order Limits scalability OR no cross-server causality

  21. Scalability Key Idea Dependency metadata explicitly captures causality Distributed verifications replace single serialization Delay exposing replicated puts until all dependencies are satisfied in the datacenter

  22. COPS architecture All Data Local Datacenter Causal Replication Client Library All Data All Data

  23. Reads Local Datacenter Client Library get

  24. Writes put + put after = ordering metadata ? Local Datacenter ? Client Library put K:V Replication Q put after

  25. Dependencies Dependencies are explicit metadata on values Library tracks and attaches them to put_afters

  26. Dependencies Dependencies are explicit metadata on values Library tracks and attaches them to put_afters Client 1 put_after(key,val,deps) put(key, val) deps . . . Kversion version (Thread-Of-Execution Rule)

  27. Dependencies Dependencies are explicit metadata on values Library tracks and attaches them to put_afters Client 2 get(K) get(K) value, version, deps' deps . . . Kversion L337 M195 value deps' L337 M195 (Gets-From Rule) (Transitivity Rule)

  28. Causal Replication put_after(K,V,deps) K:V,deps Replication Q put after

  29. Causal Replication dep_check(L337) put_after(K,V,deps) K:V,deps deps L337 M195 dep_check blocks until satisfied Once all checks return, all dependencies visible locally Thus, causal consistency satisfied

  30. System So Far ALPS + Causal Serve operations locally, replicate in background Partition keyspace onto many nodes Control replication with dependencies Proliferation of dependencies reduces efficiency Results in lots of metadata Requires lots of verification We need to reduce metadata and dep_checks Nearest dependencies Dependency garbage collection

  31. Many Dependencies Dependencies grow with client lifetimes Put Put Get Get Put Put

  32. Nearest Dependencies Transitively capture all ordering constraints

  33. The Nearest Are Few Transitively capture all ordering constraints

  34. The Nearest Are Few Only check nearest when replicating COPS only tracks nearest COPS-GT tracks non-nearest for read transactions Dependency garbage collection tames metadata in COPS-GT

  35. Experimental Setup Local Datacenter Clients COPS Servers Remote DC COPS N N N

  36. Performance All Put Workload 4 Servers / Datacenter Max Throughput (Kops/sec) 100 80 Low per-client write rates expected High per-client write rates result in 1000s of dependencies 60 40 COPS 20 COPS-GT 0 1 10 100 1000 People tweeting 1000 times/sec People tweeting 1 time/sec Average Inter-Op Delay (ms)

  37. COPS Scaling 320 Throughput (Kops) 160 80 40 20 1 2 4 8 16 COPS 1 2 4 8 16 COPS-GT LOG

  38. COPS summary ALPS: Handle all reads/writes locally Causality Explicit dependency tracking and verification with decentralized replication Optimizations to reduce metadata and checks What about fault-tolerance? Each partition uses linearizable replication within DC

  39. Monday lecture Concurrency Control 39

Related


More Related Content