Consistency and Replication Chapter 6 6.1 Introduction: replication and scalability 6.2 Data-Centric Consistency Models 6.3 Client-Centric Consistency.

Slides:



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

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 Topics Reasons for Replication Models of Consistency –Data-centric consistency models: strict, linearizable,
1 CS6320 – Performance L. Grewe 2 The Servlet Interface Java provides the interface Servlet Java provides the interface Servlet Specific Servlets implement.
Principles and Paradigms Consistency and Replication
Consistency and Replication
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
Consistency and Replication Chapter 6. Object Replication (1) Organization of a distributed remote object shared by two different clients.
Replication and Consistency Chapter 6. Data-Centric Consistency Models The general organization of a logical data store, physically distributed and replicated.
Consistency Models Based on Tanenbaum/van Steen’s “Distributed Systems”, Ch. 6, section 6.2.
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 Systems1 Chapter 8: Replication and Consistency  Replication: A key to providing good performance, high availability and fault tolerance in.
Consistency And Replication
Consistency and Replication
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.
Consistency and Replication. Why Replicate Data? Enhance reliability. Improve performance. But: if there are many replicas of the same thing, how do we.
Consistency and Replication Chapter 6. Reasons for Replication Data replication is a common technique in distributed systems. There are two reasons for.
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.
1 Consistency and Replication Reasons for Replication Reliability Performance –Scaling with respect to size of geographic area Negative Points Having multiple.
Memory Consistency Models Some material borrowed from Sarita Adve’s (UIUC) tutorial on memory consistency models.
Consistency & Replication Chapter No. 6
Consistency and Replication Chapter Concepts Reasons for Replication Reliability Earthquake, flood Misoperation Performance Place copies of data.
Consistency and Replication CSCI 4780/6780. Chapter Outline Why replication? –Relations to reliability and scalability How to maintain consistency of.
Consistency and Replication
Consistency And Replication
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Consistency.
Consistency and Replication Chapter 7. n Most of the lecture notes are based on slides by Prof. Jalal Y. Kawash at Univ. of Calgary n Some notes are based.
Computer Architecture 2015 – Cache Coherency & Consistency 1 Computer Architecture Memory Coherency & Consistency By Yoav Etsion and Dan Tsafrir Presentation.
CIS 720 Lecture 16. Client-Centric Consistency Intended to address the issues in eventual consistency for mobile clients. –Consistent for a single.
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.
Consistency and Replication Distributed Software Systems.
Ch 10 Shared memory via message passing Problems –Explicit user action needed –Address spaces are distinct –Small Granularity of Transfer Distributed Shared.
第5讲 一致性与复制 §5.1 副本管理 Replica Management §5.2 一致性模型 Consistency Models
Consistency and Replication Chapter 6 Presenter: Yang Jie RTMM Lab Kyung Hee University.
Memory Consistency Models. Outline Review of multi-threaded program execution on uniprocessor Need for memory consistency models Sequential consistency.
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.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Distributed Systems Replication. Why Replication Replication is Maintenance of copies at multiple sites Enhancing Services by replicating data Performance.
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.
Shyh-In Hwang in Yuan Ze University1 Chapter 6 Consistency and Replication.
Consistency and Replication. Outline Introduction (what’s it all about) Data-centric consistency Client-centric consistency Replica management Consistency.
Client-Centric Consistency Models
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.
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.
OS2 –Sem 1, Rasool Jalili Consistency and Replication Chapter 6.
1 Prof. Orhan Gemikonakli Module Leader: Prof. Leonardo Mostarda Università di Camerino Distributed Systems – Consistency Prof. Orhan Gemikonakli - Camerino.
Consistency and Replication (1). Topics Why Replication? Consistency Models – How do we reason about the consistency of the “global state”? u Data-centric.
CS6320 – Performance L. Grewe.
Distributed Shared Memory
Consistency and Replication
Consistency and Replication
Consistency Models.
Consistency and Replication
DATA CENTRIC CONSISTENCY MODELS
Consistency and Replication
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Distributed Systems CS
Replication Chapter 7.
Consistency and Replication
Presentation transcript:

Consistency and Replication Chapter Introduction: replication and scalability 6.2 Data-Centric Consistency Models 6.3 Client-Centric Consistency Models 6.4 Distribution Protocols: replica placement, update propagation 6.5 Consistency Protocols

2 6.1 Introduction Reasons for replication –To increase the reliability of a system –When the distributed system needs to scale in numbers and geographical area, replication is important for performance Reasons to against replication –Consistency problem When and how the modifications need to be carried out determines the price of replication

Object Replication Organization of a distributed remote object shared by two different clients. Need to solve the problem of how to protect the object against simultaneous access by multiple clients first.

4 Two solutions for handling multiple accesses a)A remote object capable of handling concurrent invocations on its own. Use mechanisms like synchronized in Java. b)A remote object for which an object adapter is required to handle concurrent invocations

5 Methods for Replicating a Shared Object (a) A distributed system for replication-aware distributed objects. Advantage: it is possible to adopt object-specific replication strategies, which is often needed inn solving scalability problems. (b) A distributed system responsible for replica management. The distributed system ensures that concurrent invocations are passed to the various replicas in the correct order. Advantage: simple for application developers.

Replication as Scaling Technique Keeping copies up to date may require more network bandwidth. If the access-to-update ratio is very low, no need to install a local replica. Keeping multiple copies consistent itself is subject to serious scalability problems. –Implementing atomicity with a large number of replicas across a large-scale network is inherently difficult when operations are also required to complete quickly. Difficulties come from the need to synchronize all replicas. –In many cases, the real solution is to loosen the consistency constraints. To what extent consistency can be loosened depends on the access and update patterns of the replicated data, as well as on the purpose for which those data are used.

7 6.2 Data-Centric Consistency Models The general organization of a logical data store, physically distributed and replicated across multiple processes. read or write A consistency model is a contract between processes and the data store. It says that if processes agree to obey certain rules, the store promises to work correctly. Normally, the process expects a read operation to return the result of the last write operation on the same data.

8 Strict Consistency Behavior of two processes, operating on the same data item. A strictly consistent store. A store that is not strictly consistent. Definition: Any read on a data item returns a value corresponding to the result of the most recent write on it. Problem: 1. Rely on absolute global time. 2. Multiple operations may take place within an interval.

9 Linearizability and Sequential Consistency (1) a)A sequentially consistent data store. b)A data store that is not sequentially consistent. Sequential consistency: The result of any execution is the same as if the operations by all processes on the data store were executed in some sequential order and the operations of each individual process appear in this sequence in the order specified by its program.

10 Linearizability and Sequential Consistency (2) Three concurrently executing processes, where x, y, and z are initially 0. Process P1Process P2Process P3 x = 1; print ( y, z); y = 1; print (x, z); z = 1; print (x, y); Linearizability: conditions for sequential consistency, plus if, then OP1(x) should precede OP2(y) in this sequence. It is used to assist formal verification of concurrent algorithms.

11 Linearizability and Sequential Consistency (3) Four valid execution sequences for the processes of the previous slide. The vertical axis is time. x = 1; print ((y, z); y = 1; print (x, z); z = 1; print (x, y); Prints: Signature: (a) x = 1; y = 1; print (x,z); print(y, z); z = 1; print (x, y); Prints: Signature: (b) y = 1; z = 1; print (x, y); print (x, z); x = 1; print (y, z); Prints: Signature: (c) y = 1; x = 1; z = 1; print (x, z); print (y, z); print (x, y); Prints: Signature: (d) output of P1, P2, P3

12 Casual Consistency (1) Definition: Writes that are potentially casually related must be seen by all processes in the same order. Concurrent writes may be seen in a different order on different machines.

13 Casual Consistency (2) This sequence is allowed with a casually-consistent store, but not with sequentially or strictly consistent store. concurrent

14 Casual Consistency (3) a)A violation of a casually-consistent store. b)A correct sequence of events in a casually-consistent store.

15 FIFO Consistency (1) Definition: Writes done by a single process are seen by all other processes in the order in which they were issued, but writes from different processes may be seen in a different order by different processes. All writes from different processes are concurrent.

16 FIFO Consistency (2) A valid sequence of events of FIFO consistency, but not causally consistent.

17 FIFO Consistency (3) Statement execution as seen by the three processes from Fig 6-7, where (a) is P1’s view, (b) is P2’s view, and (c) is P3’s view. The statements in bold are the ones that generate the output shown. The signature is impossible with sequential consistency. x = 1; print (y, z); y = 1; print(x, z); z = 1; print (x, y); Prints: 00 (a) x = 1; y = 1; print(x, z); print ( y, z); z = 1; print (x, y); Prints: 10 (b) y = 1; print (x, z); z = 1; print (x, y); x = 1; print (y, z); Prints: 01 (c)

18 FIFO Consistency (4) Two concurrent processes. Process P1Process P2 x = 1; if (y == 0) kill (P2); y = 1; if (x == 0) kill (P1); Could both P1 and P2 be killed? (1)With sequential consistency? (2)With FIFO consistency?

19 Weak Consistency In FIFO, writes originating in a single process are requires to be seen everywhere in order. However, not all applications require seeing all writes. Weak consistency only places restrictions on synchronization variables.

20 Weak Consistency (1) Properties: 1.Accesses to synchronization variables associated with a data store are sequentially consistent 2.No operation on a synchronization variable is allowed to be performed until all previous writes have been completed everywhere 3.No read or write operation on data items are allowed to be performed until all previous operations to synchronization variables have been performed. Limit the time when consistency holds, not the form of the consistency.

21 Weak Consistency (2) A program fragment in which some variables may be kept in registers, not updating their memory locations. A second process might get inconsistent values of a, b, c. int a, b, c, d, e, x, y;/* variables */ int *p, *q;/* pointers */ int f( int *p, int *q);/* function prototype */ a = x * x;/* a stored in register */ b = y * y;/* b as well */ c = a*a*a + b*b + a * b;/* used later */ d = a * a * c;/* used later */ p = &a;/* p gets address of a */ q = &b/* q gets address of b */ e = f(p, q)/* function call */

22 Weak Consistency (3) a)A valid sequence of events for weak consistency. b)An invalid sequence for weak consistency.

23 Release Consistency (1) A valid event sequence for release consistency. In weak consistency, when a synchronization variable is accessed, the data store does not know it is after write or before read. To provide this information, two kinds of synchronization variables are needed. In release consistency, acquire and release operations are provided for grouping operations to prevent interleaving.

24 Release Consistency (2) Rules: –Before a read or write operation on shared data is performed, all previous acquires done by the process must have completed successfully. –Before a release is allowed to be performed, all previous reads and writes by the process must have completed –Accesses to synchronization variables are FIFO consistent (sequential consistency is not required). Variation: lazy release consistency: at the time of release, nothing is sent.

25 Entry Consistency (1) Conditions: An acquire access of a synchronization variable is not allowed to perform with respect to a process until all updates to the guarded shared data have been performed with respect to that process. Before an exclusive mode access to a synchronization variable by a process is allowed to perform with respect to that process, no other process may hold the synchronization variable, not even in nonexclusive mode. After an exclusive mode access to a synchronization variable has been performed, any other process's next nonexclusive mode access to that synchronization variable may not be performed until it has performed with respect to that variable's owner. Each synchronization variable has a current owner, the process that last acquired it.

26 Entry Consistency (2) A valid event sequence for entry consistency. Programming problem with entry consistency: associating data with synchronization variables. One approach is the use of distributed shared object.

27 Summary of Consistency Models a)Consistency models not using synchronization operations. b)Models with synchronization operations. ConsistencyDescription StrictAbsolute time ordering of all shared accesses matters. Linearizability All processes must see all shared accesses in the same order. Accesses are furthermore ordered according to a (nonunique) global timestamp Sequential All processes see all shared accesses in the same order. Accesses are not ordered in time CausalAll processes see causally-related shared accesses in the same order. FIFO All processes see writes from each other in the order they were used. Writes from different processes may not always be seen in that order (a) ConsistencyDescription WeakShared data can be counted on to be consistent only after a synchronization is done ReleaseShared data are made consistent when a critical region is exited EntryShared data pertaining to a critical region are made consistent when a critical region is entered. (b)

Client-Centric Consistency Models The consistency models in the previous section provide a system-wide consistent view on a data store. This section consider data stores characterized by the lack of simultaneous updates, or when such updates happen, they could be easily resolved.

29 Eventual Consistency (data-centric) The principle of a mobile user accessing different replicas of a distributed database. All replicas will gradually become consistent.

30 Client-Centric Consistency Models Client-centric consistency provides guarantees for a single client concerning the consistency of accesses to a data store by that client. Notations: – : the version of data x at local copy at time t – : the set of a series of write operations at that took place since initialization to obtain – : If operations in have also been performed at at a later time

31 Monotonic Reads The read operations performed by a single process P at two different local copies of the same data store. a)A monotonic-read consistent data store b)A data store that does not provide monotonic reads. Definition: If a process reads the value of x, any successive read operation on x by that process will always return the same or a more recent value.

32 Monotonic Writes The write operations performed by a single process P at two different local copies of the same data store a)A monotonic-write consistent data store. b)A data store that does not provide monotonic-write consistency. Definition: A write operation by a process on x is completed before any successive write operation on x by the same process.

33 Read Your Writes a)A data store that provides read-your-writes consistency. b)A data store that does not. Definition: The effect of a write operation by a process on x will always be seen by a successive read operation on x by the same process.

34 Writes Follow Reads a)A writes-follow-reads consistent data store b)A data store that does not provide writes-follow-reads consistency Definition: A write operation by a process on x following a previous read on x by the same process, is guaranteed to take place on the same or a more recent value of x that was read.