Replication and Consistency

Slides:



Advertisements
Similar presentations
Linearizability Linearizability is a correctness criterion for concurrent object (Herlihy & Wing ACM TOPLAS 1990). It provides the illusion that each operation.
Advertisements

CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Systems Fall 2010 Replication Fall 20105DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
CS 582 / CMPE 481 Distributed Systems
Strong Consistency and Agreement COS 461: Computer Networks Spring 2011 Mike Freedman 1 Jenkins,
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Ordering of events in Distributed Systems & Eventual Consistency Jinyang Li.
Versioning and Eventual Consistency COS 461: Computer Networks Spring 2011 Mike Freedman 1.
Versioning, Consistency, and Agreement COS 461: Computer Networks Spring 2010 (MW 3:00-4:20 in CS105) Mike Freedman
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport (1978) Presented by: Yoav Kantor.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed Shared Memory Steve Ko Computer Sciences and Engineering University at Buffalo.
IM NTU Distributed Information Systems 2004 Replication Management -- 1 Replication Management Yih-Kuen Tsay Dept. of Information Management National Taiwan.
CSE 486/586 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
Linearizability Linearizability is a correctness criterion for concurrent object (Herlihy & Wing ACM TOPLAS 1990). It provides the illusion that each operation.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
Consistency and Replication. Outline Introduction (what’s it all about) Data-centric consistency Client-centric consistency Replica management Consistency.
Linearizability Linearizability is a correctness criterion for concurrent object (Herlihy & Wing ACM TOPLAS 1990). It provides the illusion that each operation.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
Hwajung Lee.  Improves reliability  Improves availability ( What good is a reliable system if it is not available?)  Replication must be transparent.
Linearizability Linearizability is a correctness criterion for concurrent object (Herlihy & Wing ACM TOPLAS 1990). It provides the illusion that each operation.
Replication Improves reliability Improves availability ( What good is a reliable system if it is not available?) Replication must be transparent and create.
CSE 486/586 Distributed Systems Consistency --- 3
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Replication Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.

CSE 486/586 Distributed Systems Consistency --- 2
CS6320 – Performance L. Grewe.
Distributed Systems – Paxos
CSE 486/586 Distributed Systems Consistency --- 2
CSE 486/586 Distributed Systems Consistency --- 1
Consistency and Replication
Strong Consistency & CAP Theorem
Strong Consistency & CAP Theorem
Distributed Transactions and Spanner
Consistency and Replication
Strong Consistency & CAP Theorem
View Change Protocols and Reconfiguration
Replication and Consistency
EECS 498 Introduction to Distributed Systems Fall 2017
Time and Clock.
Strong consistency and consensus
CSE 486/586 Distributed Systems Consistency --- 3
Implementing Consistency -- Paxos
Consistency Models.
Replication and Consistency
Linearizability Linearizability is a correctness criterion for concurrent object (Herlihy & Wing ACM TOPLAS 1990). It provides the illusion that each operation.
Time and Clock.
EECS 498 Introduction to Distributed Systems Fall 2017
CSE 486/586 Distributed Systems Consistency --- 1
Replication Improves reliability Improves availability
Active replication for fault tolerance
Fault-tolerance techniques RSM, Paxos
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Scalable Causal Consistency
CAP Theorem and Consistency Models
Atomic Commit and Concurrency Control
EECS 498 Introduction to Distributed Systems Fall 2017
Causal Consistency and Two-Phase Commit
Distributed Systems CS
EEC 688/788 Secure and Dependable Computing
Strong Consistency & CAP Theorem
Consistency and Replication
CSE 486/586 Distributed Systems Consistency --- 2
Implementing Consistency -- Paxos
CSE 486/586 Distributed Systems Consistency --- 3
CSE 486/586 Distributed Systems Consistency --- 1
Concurrency control (OCC and MVCC)
Presentation transcript:

Replication and Consistency COS 518: Advanced Computer Systems Lecture 3 Michael Freedman

Correct consistency model? A B Processes may be running on different machines Let’s say A and B send an op. All readers see A → B ? All readers see B → A ? Some see A → B and others B → A ?

Time and distributed systems With multiple events, what happens first? A shoots B B shoots A A dies B dies

Just use time stamps? p Time server,S Clients ask time server for time and adjust local clock, based on response How to correct for the network latency? RTT = Time_received – Time_sent Time_local_new = Time_server + (RTT / 2)

Is this sufficient? Server latency due to load? If can measure: Time_local_new = Time_server + (RTT / 2 + lag) But what about asymmetric latency? RTT / 2 not sufficient! What do we need to measure RTT? Requires no clock drift! What about “almost” concurrent events? Clocks have micro/milli-second precision Certainly not!

Order by logical events, not by wall clock time

Correct consistency model? A B Processes may be running on different machines Let’s say A and B send an op. All readers see A → B ? All readers see B → A ? Some see A → B and others B → A ?

“Lazy replication” Acknowledge writes immediately OK A Processes may be running on different machines A Acknowledge writes immediately Lazily replicate elsewhere (push or pull) Eventual consistency: Dynamo, …

“Eager replication” On a write, immediately replicate elsewhere OK A Processes may be running on different machines OK OK A On a write, immediately replicate elsewhere Wait until write committed to sufficient # of nodes before acknowledging

Consistency models Strong consistency Causal Consistency Sequential Eventual consistency

Strong consistency Provide behavior of a single copy of object: Read should return the most recent write Subsequent reads should return same value, until next write Telephone intuition: Alice updates Facebook post Alice calls Bob on phone: “Check my Facebook post!” Bob read’s Alice’s wall, sees her post

Strong Consistency? write(A,1) success 1 read(A) Phone call: Ensures happens-before relationship, even through “out-of-band” communication

Strong Consistency? write(A,1) success 1 read(A) One cool trick: Delay responding to writes/ops until properly committed

Strong Consistency? This is buggy! write(A,1) success eager replication 1 read(A) committed Isn’t sufficient to return value of third node: It doesn’t know precisely when op is “globally” committed Instead: Need to actually order read operation

Order all operations via (1) leader, (2) consensus Strong Consistency! write(A,1) success 1 read(A) Order all operations via (1) leader, (2) consensus

Strong consistency = linearizability Linearizability (Herlihy and Wang 1991) All servers execute all ops in some identical sequential order Global ordering preserves each client’s own local ordering Global ordering preserves real-time guarantee All ops receive global time-stamp using a sync’d clock If tsop1(x) < tsop2(y), OP1(x) precedes OP2(y) in sequence If ts(a) < ts (b), are either linearizable? Does ts(a) have to be before ts(b)? If concurrent, both just need to agree (tie break via some other thing (processor ID)?) Once write completes, all later reads (by wall-clock start time) should return value of that write or value of later write. Once read returns particular value, all later reads should return that value or value of later write.

Intuition: Real-time ordering write(A,1) success 1 committed read(A) Once write completes, all later reads (by wall-clock start time) should return value of that write or value of later write. Once read returns particular value, all later reads should return that value or value of later write.

Weaker: Sequential consistency Sequential = Linearizability – real-time ordering All servers execute all ops in some identical sequential order Global ordering preserves each client’s own local ordering If ts(a) < ts (b), are either linearizable? Does ts(a) have to be before ts(b)? If concurrent, both just need to agree (tie break via some other thing (processor ID)?) With concurrent ops, “reordering” of ops (w.r.t. real-time ordering) acceptable, but all servers must see same order e.g., linearizability cares about time sequential consistency cares about program order

Sequential Consistency write(A,1) success read(A) In example, system orders read(A) before write(A,1)

Valid Sequential Consistency? x  Why? Because P3 and P4 don’t agree on order of ops. Doesn’t matter when events took place on diff machine, as long as proc’s AGREE on order. What if P1 did both W(x)a and W(x)b? Neither valid, as (a) doesn’t preserve local ordering

Even Weaker: Causal consistency Potentially causally related operations? R(x) then W(x) R(x) then W(y), x ≠ y Necessary condition: Potentially causally-related writes must be seen by all processes in the same order Concurrent writes may be seen in a different order on different machines

Causal consistency Allowed with causal consistency, but not with sequential W(x)b and W(x)c are concurrent So all processes don’t see them in the same order P3 and P4 read the values ‘a’ and ‘b’ in order as potentially causally related. No ‘causality’ for ‘c’.

Causal consistency Why not sequentially consistent? P3 and P4 see W(x)b and W(x)c in different order. But fine for causal consistency Writes W(x)b and W(x)c are not causally dependent Write after write has no dependencies

Causal consistency x  A: Violation: W(x)b potentially dependent on W(x)a B: Correct. P2 doesn’t read value of a before W

Causal consistency Requires keeping track of which processes have seen which writes Needs a dependency graph of which op is dependent on which other ops …or use vector timestamps! See COS 418: https://www.cs.princeton.edu/courses/archive/fall17/cos418/docs/L4-time.pptx

Implementing strong consistency

Recall “eager replication” OK A OK OK A Recall “eager replication” On a write, immediately replicate elsewhere Wait until write committed to sufficient # of nodes before acknowledging What does this mean?

Two phase commit protocol C  P: “request write X” P  A, B: “prepare to write X” A, B  P: “prepared” or “error” P  C: “result write X” or “failed” P  A, B: “commit write X” Client C Primary P Backup A B

State machine replication Any server is essentially a state machine Operations transition between states Need an op to be executed on all replicas, or none at all i.e., we need distributed all-or-nothing atomicity If op is deterministic, replicas will end in same state

Two phase commit protocol C  P: “request <op>” P  A, B: “prepare <op>” A, B  P: “prepared” or “error” P  C: “result exec<op>” or “failed” P  A, B: “commit <op>” Client C Primary P What if primary fails? Backup fails? Backup A B

Two phase commit protocol C  P: “request <op>” P  A, B: “prepare <op>” A, B  P: “prepared” or “error” P  C: “result exec<op>” or “failed” P  A, B: “commit <op>” Client C Primary P “Okay” (i.e., op is stable) if written to > ½ backups Backup A B

Two phase commit protocol Client C > ½ nodes > ½ nodes Primary P Commit sets always overlap ≥ 1 node Any >½ nodes guaranteed to see committed op Backup A B

Wednesday class Papers: Strong consistency Lecture: Consensus, view change protocols