Download presentation
Presentation is loading. Please wait.
Published byMargaret Pitts Modified over 8 years ago
1
1 Prof. Orhan Gemikonakli Module Leader: Prof. Leonardo Mostarda Università di Camerino Distributed Systems – Consistency Prof. Orhan Gemikonakli - Camerino
2
General Introduction A distributed system organized as middleware. The middleware layer extends over multiple machines, and offers each application the same interface. Prof. Orhan Gemikonakli - Camerino2
3
General Introduction zDiscussed so far: Principles of Distributed Systems yArchitectures yProcesses yCommunication yNaming ySynchronisation Prof. Orhan Gemikonakli - Camerino3
4
General Introduction Prof. Orhan Gemikonakli - Camerino4 zTo discuss: More on principles of DSs yConsistency and Replication yFault Tolerance ySecurity – in a separate module zTo discuss: How to develop Distributed Applications (the paradigms) yDistributed object-based systems yDistributed file systems yDistributed web-based systems yDistributed coordination-based systems
5
Last Lecture zMutual Exclusion yA Centralized Algorithm yA Distributed Algorithm yA Token Ring Algorithm zLeader election yThe Bully Algorithm yA Ring Algorithm 5Prof. Orhan Gemikonakli - Camerino
6
Outline zBasic definitions about Consistency and replication zData-centric consistency models yContinuous consistency ySequential consistency yCausal consistency zClient-centric consistency models yEventual consistency yMonotonic reads yMonotonic writes yReads your writes yWrites follows reads 6Prof. Orhan Gemikonakli - Camerino
7
Consistency and Replication zData are generally replicated to yenhance reliability or yimprove performance. zReplication introduces the problem of keeping the replicas consistent. zA serious problem: keeping multiple copies consistent may itself be subject to serious scalability problems. ywhen an update operation is performed on one copy, the update should be propagated to all copies before a subsequent operation takes place (tight consistency) z“ The cure may be worse than the disease.” 7Prof. Orhan Gemikonakli - Camerino
8
Consistency Models zData-centric consistency models 1.Sequential consistency 2.Causal consistency zClient-centric consistency models 1.Eventual consistency 2.Monotonic reads 3.Monotonic writes 4.Read your writes 5.Writes follow reads Prof. Orhan Gemikonakli - Camerino8
9
Data-centric consistency models zAn important class of what are known as consistency models assumes that multiple processes simultaneously access shared data. zConsistency for these situations can be formulated with respect to what processes can expect when reading and updating the shared data. zTraditionally, consistency has been discussed in the context of read and write operations on shared data, available by means of (distributed) shared memory. 9Prof. Orhan Gemikonakli - Camerino
10
Data-centric Consistency Models zThe general organization of a logical data store, physically distributed and replicated across multiple processes. Prof. Orhan Gemikonakli - Camerino10
11
zA consistency model is essentially a contract between processes and the data store. yIt says that if processes agree to obey certain rules, the store promises to work correctly. yNormally, a process that performs a read operation on a data item, expects the operation to return a value that shows the results of the last write operation on that data. 11 Data-centric Consistency Models Prof. Orhan Gemikonakli - Camerino
12
zIn the absence of a global clock, it is difficult to define precisely which write operation is the last one. zAs an alternative, we need to provide other definitions, leading to a range of consistency models. zEach model effectively restricts the values that a read operation on a data item can return. 12 Data-centric Consistency Models Prof. Orhan Gemikonakli - Camerino
13
Continuous Consistency zThere is no best solution to replicating data zReplicating data creates consistency problems that cannot be solved in a general way zEfficient solutions? yLoosen consistency! zLoosening consistency: yNo general rules. yWhat can be tolerated is application specific. Prof. Orhan Gemikonakli - Camerino13
14
Continuous Consistency zMeasuring inconsistency in terms of numerical deviations can be used. yOne obvious example is the replication of records containing stock market prices. o Absolute deviation: An application may specify that two copies should not deviate more than for example $0.02. o Relative numerical deviation: An application may specify that two copies should not deviate more than for example 0.5%. zNumerical deviation can also be understood in terms of yOrder deviation: the number of updates that have been applied to a given replica, but have not yet been seen by others. yStaleness deviation: last time the replica was updated 14Prof. Orhan Gemikonakli - Camerino
15
Continuous consistency zOrder deviation Prof. Orhan Gemikonakli - Camerino15 Order deviation for replica A = 3 Order deviation for replica B = 2
16
Continuous Consistency zChoosing the appropriate granularity for a consistency unit (conit). (a) Two updates lead to update propagation. Prof. Orhan Gemikonakli - Camerino16
17
Continuous Consistency zChoosing the appropriate granularity for a conit. (b) No update propagation is needed (yet). Prof. Orhan Gemikonakli - Camerino17
18
Continuous Consistency zStaleness deviations relate to the last time a replica was updated. For some applications, it can be tolerated that a replica provides old data as long as it is not too old. yFor example, weather reports typically stay reasonably accurate over some time, zFinally, there are classes of applications in which the ordering of updates are allowed to be different at the various replicas, as long as the differences remain bounded. ysome updates may need to be rolled back and applied in a different order before becoming permanent. 18Prof. Orhan Gemikonakli - Camerino
19
Consistent Ordering of Operations zThese models deal with consistently ordering operations on shared, replicated data. zWhen tentative updates at replicas need to be committed, replicas will need to reach agreement on a global ordering of those updates. zIn other words, they need to agree on a consistent ordering of those updates. 19Prof. Orhan Gemikonakli - Camerino
20
Data-centric consistency models 1.Sequential consistency 2.Causal consistency Prof. Orhan Gemikonakli - Camerino20
21
zP1 does a write to a data item x, modifying its value to a zP2 later reads the value NIL, and some time after that a yit took some time to propagate the update of x to P2 21 Sequential Consistency Prof. Orhan Gemikonakli - Camerino
22
Sequential consistency zSequential consistency yThe result of any execution is the same as if the (read and write) 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. Leslie Lamport zAny valid interleaving of read and write operations is acceptable behaviour, but all processes see the same interleaving of operations. 22Prof. Orhan Gemikonakli - Camerino
23
Sequential Consistency (3) z(a) A sequentially consistent data store. (b) A data store that is not sequentially consistent. Prof. Orhan Gemikonakli - Camerino23
24
Sequential consistency zThree concurrently executing processes Prof. Orhan Gemikonakli - Camerino24
25
Sequential Consistency zFour valid execution sequences for the processes P1, P2, and P3. The vertical axis is time. Prof. Orhan Gemikonakli - Camerino25
26
Causal Consistency zThe causal consistency model represents a weakening of sequential consistency in that it makes a distinction between events that are potentially causally related and those that are not. zWrites that are potentially causally related must be seen by all processes in the same order. Concurrent writes may be seen in a different order on different machines. 26Prof. Orhan Gemikonakli - Camerino
27
Causal consistency zFor a data store to be considered causally consistent, it is necessary that the store obeys the following condition: yWrites that are potentially causally related … must be seen by all processes in the same order. yConcurrent writes … may be seen in a different order on different machines. Prof. Orhan Gemikonakli - Camerino27
28
Causal Consistency (2) zThis sequence is allowed with a causally-consistent store, but not with a sequentially consistent store. zW(x)b and W(x)c are concurrent, so it is not required that all processes see them in the same order. Prof. Orhan Gemikonakli - Camerino28
29
Causal Consistency (3) z A violation of a causally-consistent store. Prof. Orhan Gemikonakli - Camerino29
30
Causal Consistency (4) z(b) A correct sequence of events in a causally-consistent store. Prof. Orhan Gemikonakli - Camerino30
31
Client-centric consistency models zThe consistency models described so far aim at providing a system wide consistent view on a data store. zThe data stores we consider are characterised by the lack of simultaneous updates, or when such updates happen, they can easily be resolved. zIn client-centric consistency, inconsistencies can be hidden in a relatively cheap way. 31Prof. Orhan Gemikonakli - Camerino
32
Client-centric consisteny models 1.Eventual consistency 2.Monotonic reads 3.Monotonic writes 4.Read your writes 5.Writes follow reads Prof. Orhan Gemikonakli - Camerino32
33
Eventual Consistency zIn WWW, DNS write conflicts rarely happen. Why? zAll replicas will gradually become consistent. This form of consistency is called eventual consistency. zWhat is the problem? 33Prof. Orhan Gemikonakli - Camerino
34
Eventual Consistency zThe principle of a mobile user accessing different replicas of a distributed database. Prof. Orhan Gemikonakli - Camerino34
35
client-centric zThe problem can be alleviated by introducing client- centric consistency. zIn essence, client-centric consistency provides guarantees for a single client concerning the consistency of accesses to a data store by that client. zBayou essentially distinguishes four different consistency models: yMonotonic Reads yMonotonic Writes yRead Your Writes yWrites Follow Reads 35Prof. Orhan Gemikonakli - Camerino
36
Monotonic Reads (1) zA data store is said to provide monotonic- read consistency if the following condition holds: yIf a process reads the value of a data item x and any successive read operation on x by that process will always return that same value or a more recent value. Prof. Orhan Gemikonakli - Camerino36
37
Monotonic Reads (2) zThe 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. Prof. Orhan Gemikonakli - Camerino37
38
Monotonic Reads (3) zThe read operations performed by a single process P at two different local copies of the same data store. (b) A data store that does not provide monotonic reads. Prof. Orhan Gemikonakli - Camerino38
39
Monotonic Writes (1) zIn a monotonic-write consistent store, the following condition holds: yA write operation by a process on a data item x is completed before any successive write operation on x by the same process. Prof. Orhan Gemikonakli - Camerino39
40
Monotonic Writes (2) zThe 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. Prof. Orhan Gemikonakli - Camerino40
41
Monotonic Writes (3) zThe write operations performed by a single process P at two different local copies of the same data store. (b) A data store that does not provide monotonic-write consistency. Prof. Orhan Gemikonakli - Camerino41
42
Read Your Writes (1) zA data store is said to provide read-your- writes consistency, if the following condition holds: yThe effect of a write operation by a process on data item x will always be seen by a successive read operation on x by the same process. Prof. Orhan Gemikonakli - Camerino42
43
Read Your Writes (2) zA data store that provides read-your-writes consistency. Prof. Orhan Gemikonakli - Camerino43
44
Read Your Writes (3) zA data store that does not. Prof. Orhan Gemikonakli - Camerino44
45
Writes Follow Reads (1) zA data store is said to provide writes-follow- reads consistency, if the following holds: yA 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. Prof. Orhan Gemikonakli - Camerino45
46
Writes Follow Reads (2) zA writes-follow-reads consistent data store. Prof. Orhan Gemikonakli - Camerino46
47
Writes Follow Reads (3) zA data store that does not provide writes-follow- reads consistency. Prof. Orhan Gemikonakli - Camerino47
48
Summary zBasic definitions about Consistency and replication zData-centric consistency models yContinuous consistency ySequential consistency yCausal consistency zClient-centric consistency models yMonotonic reads yMonotonic writes yReads your writes yWrites follows reads 48Prof. Orhan Gemikonakli - Camerino
49
Next Lecture zState machine replication approach zPaxos protocol Prof. Orhan Gemikonakli - Camerino49
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.