Distributed Systems CS 15-440 Consistency and Replication – Part II Lecture 11, Oct 10, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.

Slides:



Advertisements
Similar presentations
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 7: Consistency 4/13/20151Distributed Systems - COMP 655.
Advertisements

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.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
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
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.
Distributed Systems Spring 2009
Distributed Systems CS Consistency and Replication – Part III Lecture 12, Oct 12, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Distributed Systems CS Consistency and Replication – Part I Lecture 10, Oct 5, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Today: –Introduction –Consistency models Data-centric consistency.
Computer Science Lecture 16, page 1 CS677: Distributed OS Last Class: Web Caching Use web caching as an illustrative example Distribution protocols –Invalidate.
Distributed Systems CS Google Chubby and Message Ordering Recitation 4, Sep 29, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Distributed Systems CS Synchronization – Part II Lecture 8, Sep 28, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Distributed Systems CS Case Study: Replication in Google Chubby Recitation 5, Oct 06, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Replication and Consistency CS-4513 D-term Replication and Consistency CS-4513 Distributed Computing Systems (Slides include materials from Operating.
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Introduction Consistency models –Data-centric consistency models.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Consistency.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Client-Centric.
Consistency and Replication
Feb 7, 2001CSCI {4,6}900: Ubiquitous Computing1 Announcements Tomorrow’s class is officially cancelled. If you need someone to go over the reference implementation.
Consistency And Replication
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Consistency.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed Shared Memory Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Systems CS Consistency and Replication – Part II Lecture 11, Oct 2, 2013 Mohammad Hammoud.
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.
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.
第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.
Linearizability Linearizability is a correctness criterion for concurrent object (Herlihy & Wing ACM TOPLAS 1990). It provides the illusion that each operation.
Distributed Systems CS Consistency and Replication – Part IV Lecture 21, Nov 10, 2014 Mohammad Hammoud.
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.
Distributed Systems CS Consistency and Replication – Part I Lecture 10, September 30, 2013 Mohammad Hammoud.
12/17/2015Distributed Systems - Comp 6551 Consistency and Replication The problems we are trying to solve Types of consistency Approaches to propagation.
Consistency and Replication. Outline Introduction (what’s it all about) Data-centric consistency Client-centric consistency Replica management Consistency.
Distributed Systems CS Consistency and Replication – Part IV Lecture 13, Oct 23, 2013 Mohammad Hammoud.
Client-Centric Consistency Models
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.
CSE 486/586 Distributed Systems Consistency --- 3
Consistency and Replication Chapter 6 Presenter: Yang Jie RTMM Lab Kyung Hee University.
Distributed Systems CS Consistency and Replication – Part III Lecture 13, Oct 26, 2015 Mohammad Hammoud.
Distributed Systems CS Consistency and Replication – Part I Lecture 11, Oct 19, 2015 Mohammad Hammoud.
Distributed Systems CS Consistency and Replication – Part IV Lecture 14, Oct 28, 2015 Mohammad Hammoud.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Consistency and Replication CSCI 6900/4900. FIFO Consistency Relaxes the constraints of the causal consistency “Writes done by a single process are seen.
Consistency and Replication (1). Topics Why Replication? Consistency Models – How do we reason about the consistency of the “global state”? u Data-centric.
Distributed Systems CS
Consistency and Replication
Consistency and Replication
Replication and Consistency
Distributed Systems CS
Consistency Models.
Replication and Consistency
Distributed Systems CS
Linearizability Linearizability is a correctness criterion for concurrent object (Herlihy & Wing ACM TOPLAS 1990). It provides the illusion that each operation.
Consistency and Replication
DATA CENTRIC CONSISTENCY MODELS
Distributed Systems CS
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Distributed Systems CS
Replication and Consistency
Presentation transcript:

Distributed Systems CS Consistency and Replication – Part II Lecture 11, Oct 10, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud

Today…  Last Session  Consistency and Replication  Introduction and Data-Centric Consistency Models  Today’s session  Consistency and Replication – Part II  Finish Data-centric Consistency Models  Client-Centric Consistency Models  Replica Management  Announcement:  Interim design report for Project 2 due today 2

Recap: Trade-offs in Maintaining Consistency Maintaining consistency should balance between the strictness of consistency versus efficiency How much consistency is “good-enough” depends on the application 3 Strict Consistency Generally hard to implement, and is inefficient Loose Consistency Easier to implement, and is efficient

Recap: Consistency Models 4 A consistency model states the level of consistency provided by the data-store to the processes while reading and writing the data Consistency ModelsData-centric Models for Specifying Consistency Continuous Consistency Model Models for Consistent Ordering of Operations Sequential Consistency Model Causal Consistency Model Client-centric

Types of Ordering 1.Total Ordering 2.Sequential Ordering 3.Causal Ordering 5

Causality (Recap) Causal relation between two events If a and b are two events a and b such that a happened-before b or a  b, and If the (logical) time when event a and b is received at a process P i is denoted by C i (a) and C i (b) Then, if we can infer that a  b by observing that C i (a) < C i (b), then a and b are causally related Causality can be implemented using Vector Clocks 6

Causal vs. Concurrent events Consider an interaction between processes P 1 and P 2 operating on replicated data x and y 7 P1 P2 W(x)a R(x)a P1 P2 W(x)a W(y)b R(x)b =Read variable x; Result is b W(x)b = Write variable x; Result is b P1 =Process P1=Timeline at P1 W(y)b Events are causally related Events are not concurrent Computation of y at P 2 may have depended on value of x written by P 1 Events are not causally related Events are concurrent Computation of y at P 2 does not depend on value of x written by P 1 R(x)a

Causal Ordering Causal Order If process P i sends a message m i and P j sends m j, and if m i  m j (operator ‘  ’ is Lamport’s happened-before relation) then any correct process that delivers m j will deliver m i before m j In the example, m (1,1) and m (3,1) are in Causal Order Drawback: The happened-before relation between m i and m j should be induced before communication m (1,1) m (1,2) P1 P2 P3 m (3,1) Valid Causal Orders m (1,1) m (1,2) P1 P2 P3 m (3,1) Invalid Causal Order

Causal Consistency Model A data-store is causally consistent if: Writes that are potentially causally related must be seen by all the processes in the same order Concurrent writes may be seen in a different order on different machines 9

Example of a Causally Consistent Data-store 10 P1 P2 P3 P4 W(x)a R(x)a R(x)b =Read variable x; Result is b W(x)b = Write variable x; Result is b P1 =Process P1=Timeline at P1 W(x)b W(x)c R(x)cR(x)b R(x)c A Causally Consistent Data-Store But not a Sequentially Consistent Data-Store Concurrent writes Causal writes

Implications of adopting a Causally Consistent Data-store for Applications Processes have to keep track of which processes have seen which writes This requires maintaining a dependency graph between write and read operations Vector clocks provides a way to maintain causally consistent data-base 11

Topics Covered in Data-centric Consistency Models 12 Data-centric Consistency Models Models for Specifying Consistency Continuous Consistency Model Models for Consistent Ordering of Operations Sequential Consistency Model Causal Consistency Model But, is Data-centric Consistency Model good for all applications?

Applications that can use Data-centric Models Data-centric models are applicable when many processes are concurrently updating the data-store But, do all applications need all replicas to be consistent? 13 Webpage-A Event: Update Webpage-A Webpage-A Data-Centric Consistency Model is too strict when One client process updates the data Other processes read the data, and are OK with reasonably stale data

Summary of Data-Centric Consistency Models 14 These models allow measuring and specifying the consistency levels that are tolerable to the application Data-centric Consistency Models Models for Specifying Consistency Continuous Consistency Model Models for Consistent Ordering of Operations Sequential Consistency Model Causal Consistency Model These models specify what ordering of operations are ensured at the replicas Data-centric consistency models describe how the replicated data is kept consistent across different data-stores, and what the process can expect from the data-store Data-centric models are too strict when: most operations are read operations updates are generally triggered from one client process

Overview 15 Consistency Models Data-centric Models for Specifying Consistency Continuous Consistency Model Models for Consistent Ordering of Operations Sequential Consistency Model Causal Consistency Model Client-centric

Client-Centric Consistency Models Data-centric models lead to excessive overheads in applications where: a majority operations are reads, and updates occur frequently, and are often from one client process For such applications, a weaker form of consistency called Client-centric Consistency is employed for improving efficiency Client-centric consistency models specify two requirements: 1.Eventual Consistency All the replicas should eventually converge on a final value 2.Client Consistency Guarantees Each client processes should be guaranteed some level of consistency while accessing the data value from different replicas 16

Overview 17 Consistency ModelsData-centric Models for Specifying Consistency Continuous Consistency Model Models for Consistent Ordering of Operations Sequential Consistency Model Causal Consistency Model Client-centric Eventual Consistency Client Consistency Guarantees

Eventual Consistency Many applications can tolerate a inconsistency for a long time Webpage updates, Web Search – Crawling, indexing and ranking, Updates to DNS Server In such applications, it is acceptable and efficient if replicas in the data-store rarely exchange updates A data-store is termed as Eventually Consistent if: All replicas will gradually become consistent in the absence of updates Typically, updates are propagated infrequently in eventually consistent data-stores 18

Designing Eventual Consistency In eventually consistent data-stores, Write-write conflicts are rare Two processes that write the same value are rare Generally, one client updates the data value e.g., One DNS server updates the name to IP mapping Such rare conflicts can be handled through simple mechanisms, such as mutual exclusion Read-write conflict are more frequent Conflicts where one process is reading a value, while another process is writing a value to the same variable Eventual Consistency Design has to focus on efficiently resolving such conflicts 19

Challenges in Eventual Consistency Eventual Consistency is not good-enough when the client process accesses data from different replicas We need consistency guarantees for a single client while accessing the data-store 20 Webpage-A Event: Update Webpage-A Webpage-A

Overview 21 Consistency Models Data-centric Models for Specifying Consistency Continuous Consistency Model Models for Consistent Ordering of Operations Sequential Consistency Model Causal Consistency Model Client-centric Eventual Consistency Client Consistency Guarantees

Client-centric consistency provides guarantees for a single client for its accesses to a data-store Example: Providing consistency guarantee to a client process for data x replicated on two replicas. Let x i be the local copy of a data x at replica L i. 22 L1L1 L1L1 L2L2 L2L2 W(x 1 )0 W(x 2 )0 W(x 1 )2 x+=2 W(x 1 )1 x-=1 W(x 1 )5 x*=5 WS(x 1 ) x-=2 W(x 2 )3 R(x 2 )5 LiLi LiLi = Replica i R(x i )b = Read variable x at replica i; Result is b W(x)b = Write variable x at replica i; Result is b WS(x i ) = Write Set WS(x 1 ) = Write Set for x 1 = Series of ops being done at some replica that reflects how L 1 updated x 1 till this time WS(x 1 ;x 2 ) = Write Set for x 1 and x 2 = Series of ops being done at some replica that reflects how L 1 updated x 1 and, later on, how x 2 is updated on L 2 WS(x 1 ;x 2 ) WS(x 1 )

Client Consistency Guarantees We will study four types of client-centric consistency models 1 1.Monotonic Reads 2.Monotonic Writes 3.Read Your Writes 4.Write Follow Reads The work is based on the distributed database system built by Terry et al. [1]

Overview 24 Consistency Models Data-centricClient-centric Eventual Consistency Client Consistency Guarantees Monotonic ReadsMonotonic WritesRead Your Writes Write Follow Reads

Monotonic Reads The model provides guarantees on successive reads If a client process reads the value of data item x, then any successive read operation by that process should return the same or a more recent value for x 25 L1L1 L1L1 L2L2 L2L2 WS(x 1 ) WS(x 1 ;x 2 )R(x 2 ) R(x 1 ) Return of R(x 2 ) should at least as recent as R(x 1 ) Order in which client process carries out the operations

Monotonic Reads – Puzzle 26 L1L1 L1L1 L2L2 L2L2 WS(x 1 ) WS(x 1 ;x 2 ) R(x 2 )6 R(x 1 )5 FIGURE 1 W(x 2 )6 L1L1 L1L1 L2L2 L2L2 WS(x 1 ) WS(x 2 ) R(x 2 )6 R(x 1 )5 FIGURE 2 W(x 2 )6 Recognize data-stores that provide monotonic read guarantees L1L1 L1L1 L2L2 L2L2 WS(x 1 ) WS(x 1 ;x 2 ) R(x 2 )6 R(x 1 )5 FIGURE 3 W(x 2 )6W(x 2 )7 R(x 1 )7WS(x 2 ;x 1 )

Overview 27 Consistency Models Data-centricClient-centric Eventual Consistency Client Consistency Guarantees Monotonic ReadsMonotonic WritesRead Your Writes Write Follow Reads

Monotonic Writes This consistency model assures that writes are monotonic A write operation by a client process on a data item x is completed before any successive write operation on x by the same process A new write on a replica should wait for all old writes on any replica 28 L1L1 L1L1 L2L2 L2L2 WS(x 1 )W(x 2 ) W(x 1 ) W(x 2 ) operation should be performed only after the result of W(x 1 ) has been updated at L 2 L1L1 L1L1 L2L2 L2L2 W(x 2 ) W(x 1 ) The data-store does not provide monotonic write consistency

Monotonic Writes – An Example Example: Updating individual libraries in a large software source code which is replicated Updates can be propagated in a lazy fashion Updates are performed on a part of the data item Some functions in an individual library is often modified and updated Monotonic writes: If an update is performed on a library, then all preceding updates on the same library are first updated Question: If the update overwrites the complete software source code, is it necessary to update all the previous updates? 29

Overview 30 Consistency Models Data-centricClient-centric Eventual Consistency Client Consistency Guarantees Monotonic ReadsMonotonic WritesRead Your Writes Write Follow Reads

Read Your Writes The effect of a write operation on a data item x by a process will always be seen by a successive read operation on x by the same process Example scenario: In systems where password is stored in a replicated data-base, the password change should be seen immediately 31 L1L1 L1L1 L2L2 L2L2 WS(x 1 ;x 2 )R(x 2 ) W(x 1 ) R(x 2 ) operation should be performed only after the updating the Write Set WS(x 1 ) at L 2 L1L1 L1L1 L2L2 L2L2 WS(x 2 )R(x 2 ) W(x 1 ) A data-store that does not provide Read Your Write consistency

Overview 32 Consistency Models Data-centricClient-centric Eventual Consistency Client Consistency Guarantees Monotonic ReadsMonotonic WritesRead Your Writes Write Follow Reads

A write operation by a process on a data item x following a previous read operation on x by the same process is guaranteed to take place on the same or a more recent value of x that was read Example scenario: Users of a newsgroup should post their comments only after they have read all previous comments 33 L1L1 L1L1 L2L2 L2L2 WS(x 1 ;x 2 )W(x 2 ) R(x 1 ) W(x 2 ) operation should be performed only after the all previous writes have been seen WS(x 1 ) L1L1 L1L1 L2L2 L2L2 WS(x 2 )W(x 2 ) R(x 1 ) A data-store that does not guarantee Write Follow Read Consistency Model WS(x 1 )

Summary of Client-centric Consistency Models 34 Client-centric Consistency Models Eventual Consistency Client Consistency Guarantees Monotonic Reads Monotonic Writes Read Your Writes Write Follow Reads Each client processes should be guaranteed some level of consistency while accessing the data value from different replicas All replicas will gradually become consistent in the absence of updates Client-centric Consistency Model defines how a data-store presents the data value to an individual client when the client process accesses the data value across different replicas. It is generally useful in applications where: one client always updates the data-store. read-to-write ratio is high

Topics covered in Consistency Models 35 Consistency Models Data-centric Models for Specifying Consistency Continuous Consistency Model Models for Consistent Ordering of Operations Sequential Consistency Model Causal Consistency Model Client-centric Eventual Consistency Client Consistency Guarantees Monotonic Reads Read your writes Write follow reads

Summary of Consistency Models Different applications require different levels of consistency Data-centric consistency models Define how replicas in a data-store maintain consistency Client-centric consistency models Provide an efficient, but weaker form of consistency when Here, one client process updates the data item, and many processes read the replica 36

Next Class Replica Management Describes where, when and by whom replicas should be placed Consistency Protocols We study “how” consistency is ensured in distributed systems 37

References [1] Terry, D.B., Demers, A.J., Petersen, K., Spreitzer, M.J., Theimer, M.M., Welch, B.B., "Session guarantees for weakly consistent replicated data", Proceedings of the Third International Conference on Parallel and Distributed Information Systems, 1994 [2] Lili Qiu, Padmanabhan, V.N., Voelker, G.M., “On the placement of Web server replicas”, Proceedings of IEEE INFOCOM [3] Rabinovich, M., Rabinovich, I., Rajaraman, R., Aggarwal, A., “A dynamic object replication and migration protocol for an Internet hosting service”, Proceedings of IEEE International Conference on Distributed Computing Systems (ICDCS), 1999 [4] 38