1 CS 194: Lecture 8 Consistency and Replication Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer.

Slides:



Advertisements
Similar presentations
CS 542: Topics in Distributed Systems Diganta Goswami.
Advertisements

1 CS 194: Elections, Exclusion and Transactions Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer.
Linearizability Linearizability is a correctness criterion for concurrent object (Herlihy & Wing ACM TOPLAS 1990). It provides the illusion that each operation.
Replication. Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures.
Consistency and Replication Chapter 7 Part II Replica Management & Consistency Protocols.
Consistency and Replication Chapter Introduction: replication and scalability 6.2 Data-Centric Consistency Models 6.3 Client-Centric Consistency.
Consistency and Replication Chapter Topics Reasons for Replication Models of Consistency –Data-centric consistency models: strict, linearizable,
Consistency and Replication
DISTRIBUTED SYSTEMS II REPLICATION CNT. II Prof Philippas Tsigas Distributed Computing and Systems Research Group.
Consistency and Replication Chapter 6. Object Replication (1) Organization of a distributed remote object shared by two different clients.
Consistency and Replication. Replication of data Why? To enhance reliability To improve performance in a large scale system Replicas must be consistent.
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Today: –Introduction –Consistency models Data-centric consistency.
Distributed Systems Fall 2010 Replication Fall 20105DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Distributed Systems Spring 2009
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Today: –Introduction –Consistency models Data-centric consistency.
More on Replication and Consistency CS-4513, D-Term More on Replication and Consistency CS-4513 D-Term 2007 (Slides include materials from Operating.
Computer Science Lecture 16, page 1 CS677: Distributed OS Last Class: Web Caching Use web caching as an illustrative example Distribution protocols –Invalidate.
CS 582 / CMPE 481 Distributed Systems
1 CS 194: Lecture 15 Midterm Review. 2 Notation  Red titles mean start of new topic  They don’t indicate increased importance…..
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Introduction Consistency models –Data-centric consistency models.
1 CS 194: Lecture 9 Bayou Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer Sciences University.
Computer Science Lecture 16, page 1 CS677: Distributed OS Last Class:Consistency Semantics Consistency models –Data-centric consistency models –Client-centric.
More on Replication and Consistency CS-4513 D-term More on Replication and Consistency CS-4513 Distributed Computing Systems (Slides include materials.
Consistency and Replication Chapter 7
Consistency & Replication Chapter No. 6
1 6.4 Distribution Protocols Different ways of propagating/distributing updates to replicas, independent of the consistency model. First design issue.
Consistency and Replication CSCI 4780/6780. Chapter Outline Why replication? –Relations to reliability and scalability How to maintain consistency of.
1 CS 268: Lecture 20 Classic Distributed Systems: Bayou and BFT Ion Stoica Computer Science Division Department of Electrical Engineering and Computer.
Consistency And Replication
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Consistency.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Data Versioning Lecturer.
Consistency and Replication Chapter 6. Release Consistency (1) A valid event sequence for release consistency. Use acquire/release operations to denote.
Consistency and Replication. Replication of data Why? To enhance reliability To improve performance in a large scale system Replicas must be consistent.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Outline Introduction (what’s it all about) Data-centric consistency Client-centric consistency Replica management Consistency protocols.
Consistency and Replication Distributed Software Systems.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Consistency.
IM NTU Distributed Information Systems 2004 Replication Management -- 1 Replication Management Yih-Kuen Tsay Dept. of Information Management National Taiwan.
第5讲 一致性与复制 §5.1 副本管理 Replica Management §5.2 一致性模型 Consistency Models
Replication (1). Topics r Why Replication? r System Model r Consistency Models – How do we reason about the consistency of the “global state”? m Data-centric.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Distributed Systems CS Consistency and Replication – Part IV Lecture 21, Nov 10, 2014 Mohammad Hammoud.
Chapter 7 Consistency And Replication (CONSISTENCY PROTOCOLS)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Consistency and Replication Chapter 6. Topics Reasons for Replication Models of Consistency –Data-centric consistency models –Client-centric consistency.
Replication (1). Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures.
Distributed Systems CS Consistency and Replication – Part IV Lecture 13, Oct 23, 2013 Mohammad Hammoud.
Hwajung Lee.  Improves reliability  Improves availability ( What good is a reliable system if it is not available?)  Replication must be transparent.
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
Consistency and Replication Chapter 6 Presenter: Yang Jie RTMM Lab Kyung Hee University.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
OS2 –Sem 1, Rasool Jalili Consistency and Replication Chapter 6.
CS6320 – Performance L. Grewe.
6.4 Data and File Replication
Consistency and Replication
Replication and Consistency
Consistency Models.
Replication and Consistency
Consistency and Replication
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Distributed Systems CS
Replica Placement Model: We consider objects (and don’t worry whether they contain just data or code, or both) Distinguish different processes: A process.
Last Class: Web Caching
EEC 688/788 Secure and Dependable Computing
CSE 486/586 Distributed Systems Consistency --- 3
Presentation transcript:

1 CS 194: Lecture 8 Consistency and Replication Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley Berkeley, CA

2 Today’s Lecture  Motivation  Data-centric models of consistency  Consistency mechanisms  Eventual consistency  Mechanisms for eventual consistency

3 Next Lecture  Client-centric notions of consistency  Bayou system  Causally-consistent lazy replication

4 Why Replicate Data?  High volume  Low latency  High availability

5 Examples  DNS: caching enhances scalability  Web: Akamai, etc.  Distributed file systems: Coda, Bayou, etc.

6 Why Not Replicate?  Must keep replicas transparent to clients -Clients operate on logical objects -Operations executed on physical objects  Therefore, must keep replicas consistent

7 Inherent Tension  If require all copies to be identical all the time, then can only have one copy  If have multiple copies, must tolerate some degree of inconsistency  The weaker the consistency requirement, the easier it is to build scalable solutions  If consistency requirement is too strong, replication might hurt performance, not help it

8 Models of Consistency  Described in terms of the data in various locations  Next lecture we will describe this in terms of the clients reading the data  These are two very different perspectives

9 Not Transactions!  We are considering independent operations  This means that reading a value and then writing based on that value appears as two independent operations  Weaker requirement on consistency

10 Strict Consistency  Any read on a data item x returns a value corresponding to the most recent write of x  Problems: -“Most recent” only has meaning with perfectly synchronized clocks -Perfect synchronization physically impossible, unless only one replica  When might you want this? -Auction?

11 Linearizable  Operations executed in a sequential order dictated by a set of timestamps  Timestamps within a process are time-ordered  When might this be appropriate? -Formal analysis?

12 Sequential Consistency  Operations appear in the same sequential order at all replicas  Operations from the same client are processed in the order they were submitted by that process

13 Causal Consistency  Writes that are causally related must be seen by processes in the same order. Concurrent writes may be seen in a different order on different machines.  Similar to our notions of vector timestamps

14 FIFO Consistency  Writes done by a single process are seen by all processes as occurring in the order in which they were issued

15 Focus on Sequential Consistency  Good compromise between utility and practicality -We can do it -We can use it  Stricter: too hard  Less strict: replicas can disagree forever

16 Mechanisms for Sequential Consistency  Local cache replicas  Primary-based replication protocols  Replicated-write protocols  Cache-coherence protocols [won’t cover]

17 Local Cache  Primary copy of data (e.g., web server)  Client reads data  Client (or proxy cache on its behalf) saves copy of data for a short time (TTL)  Reads issued during the TTL get cached copy  What form of consistency is that?

18 Variety of Cache Updates  Pull: client asks for update  Push: server pushes updates to all sites that have cached copies  Leases: Push for TTL, after that pull

19 Push vs Pull  Push:server keeps state about all cached copies data sent even when unneeded response time low  Pull:server keeps no state data only sent when needed response time can be higher

20 Why Not Multicast for Caches?  Two multicast groups for each data item x -Invalidation group -Update group  When x is updated, server sends messages to groups -Data to update group, only notice of update to invalication group  When x is cached somewhere, that replica joins one of the multicast groups  Properties: -No state in server -Reliability of update delivery is hard

21 The Boring Methods  Primary-based protocols  Local write vs remote write  Local read vs remote read  Backup vs not

22 Primary with Remote Read/Write

23 Primary Remote-Write w/Backup

24 Primary-Based Local-Write

25 Primary-Backup with Local Writes

26 Slightly More Interesting  Distributed Writing  No primary copy!

27 Quorum-based Protocols  Assign a number of votes V(I) to each replica I  Let V be the total number of votes  Define VR=read quorum, VW=write quorum  VR+VW > V (why?)  VW > V/2 (why?)

28 Results  Only one writer at a time can achieve write quorum  Every reader sees at least one copy of the most recent read (takes one with most recent version number)

29 Possible Policies  ROWA: VR=1, VW=N -Fast reads, slow writes (and easily blocked)  RAWO: VR=N, VW=1 -Fast writes, slow reads (and easily blocked)  Majority: VR=VW=N/2+1 -Both moderately slow, but extremely high availability  See Gifford’s paper

30 Quorum

31 Scaling  None of these protocols scale  To read or write, you have to either -(a) contact a primary copy -(b) contact over half of the replicas  All this complication is to ensure sequential consistency  Can we weaken sequential consistency without losing some important features?

32 What Consistency Do We Want?  Sequential consistency requires that at every point, every replica has a value that could be the result of the globally- agreed sequential application of writes  This does not require that all replicas agree at all times, just that they always take on the same sequence of values  Why is this so important?  Why not allow temporary out-of-sequence writes?

33 What Consistency Do We Want? (2)  Note: all forms of consistency weaker than sequential allow replicas to disagree forever  We want to allow out-of-order operations, but only if the effects are temporary

34 Eventual Consistency  If all updating stops then eventually all replicas will converge to the identical values  Furthermore, the value towards which these values converge has sequential consistency of writes.

35 Implementing Eventual Consistency  All writes eventually propagate to all replicas  Writes, when they arrive, are applied in the same order at all replicas -Easily done with timestamps

36 Update Propagation  Rumor or epidemic stage: -Attempt to spread an update quickly -Willing to tolerate incompletely coverage in return for reduced traffic overhead  Correcting omissions: -Making sure that replicas that weren’t updated during the rumor stage get the update

37 Rumor Spreading: Push  When a server P has just been updated for data item x, it contacts some other server Q at random and tells Q about the update  If Q doesn’t have the update, then it (after some time interval) contacts another server and repeats the process  If Q already has the update, then P decides, with some probability, to stop spreading the update

38 Performance of Push Scheme  Not everyone will hear! -Let S be fraction of servers not hearing rumors -Let M be number of updates propagated per server  S= exp{-M}  Note that M depends on the probability of continuing to push rumor.

39 Pull Schemes  Periodically, each server Q contacts a random server P and asks for any recent updates  P uses the same algorithm as before in deciding when to stop telling rumor  Performance: better (next slide), but requires contact even when no updates

40 Variety of Schemes  When to stop telling rumor: (conjectures) -Counter: S ~ exp{-M 3 } -Min-counter: S ~ exp{-2 M }  Controlling who you talk to next -Can do better  Knowing N: -Can choose parameters so that S << 1/N  Spatial dependence

41 Finishing Up  There will be some sites that don’t know after the initial rumor spreading stage  How do we make sure everyone knows?

42 Anti-Entropy  Every so often, two servers compare compete datasets  Use various techniques to make this cheap  If any data item is discovered to not have been fully replicated, it is considered a new rumor and spread again

43 We Don’t Want Lazarus!  Consider server P that does offline  While offline, data item x is deleted  When server P comes back online, what happens?

44 Death Certificates  Deleted data is replaced by a death certificate  That certificate is kept by all servers for some time T that is assumed to be much longer than required for all updates to propagate completely  But every death certificate is kept by at least one server forever

45 Next Lecture  Client-centric notions of consistency  Bayou system  Causally-consistent lazy replication