Consistency and Replication in Distributed System
Consistency and Replication in Distributed System
3
Data-Centric Consistency Models
Data-centric Consistency Models
Strict Consistency
Linearizability and Sequential Consistency
Causal Consistency
FIFO Consistency
Weak Consistency
Release Consistency
Entry Consistency
(5)
Consistency Model Diagram Notation
Wi(x)a – a write by process ‘i’ to item ‘x’
with a value of ‘a’. That is, ‘x’ is set to ‘a’.
(Note: The process is often shown as ‘Pi’).
7
Sequential Consistency
Sequential consistency: weaker than strict consistency
◦ Assumes all operations are executed in some sequential order and
each process issues operations in program order
Any valid interleaving is allowed
All agree on the same interleaving
Each process preserves its program order
Nothing is said about “most recent write”
(11)
Weak Consistency
Weak consistency model says that not all applications
need to see all writes − the criteria for same order is
relaxed.
This model ensures consistency on a group of
operations, as against individual reads and writes as seen
in the other consistency models.
It introduces the concept of a synchronization variable
“S” which is associated with a particular datastore.
The process acquiring this synchronization variable is
allowed to access the critical region and when it leaves
the variable should be released.
The synchronization variable for a datastore assures the
process that the value it has got is the most recently
written value of that datastore.
(12)
Weak Consistency
Properties:
Accesses to synchronization variables
associated with a data store are
sequentially consistent
(15)
Release Consistency
In weak consistency model no distinction is made for
acquiring synchronization variable for read and write
operations on a datastore.
(16)
Release Consistency
Rules:
(17)
Release Consistency
(18)
Entry Consistency
In entry consistency, an acquire and a release are used
for individual data items rather than entire datastore.
(20)
Summary of Data-centric Consistency Models
Consistency Description
All processes must see all shared accesses in the same order. Accesses are furthermore
Linearizability
ordered according to a (nonunique) global timestamp
Sequential All processes see all shared accesses in the same order. Accesses are not ordered in time
Causal All processes see causally-related shared accesses in the same order.
All processes see writes from each other in the order they were used. Writes from different
FIFO
processes may not always be seen in that order
(a)
Consistency Description
Weak Shared data can be counted on to be consistent only after a synchronization is done
Release Shared data are made consistent when a critical region is exited
Entry Shared data pertaining to a critical region are made consistent when a critical region is
entered.
(b)
Client-centric Consistency Models
The data stores characterized by the lack of simultaneous
updates,
Most operations involve reading data. These data stores
offer a very weak consistency model, called eventual
consistency.
in many database systems, most processes hardly ever
perform update operations; they mostly read data from
the database. Only one, or very few processes perform
update operations.
The question then is how fast updates should be made
available to only reading processes.
another example is the World Wide Web. In virtually all
cases, Web pages are updated by a single authority,
Eventual Consistency
– Read-your-writes Consistency
– Writes-follows-reads Consistency
(24)
Client-Centric Consistency
• xi[t] -version of data x at copy Li at time t
(25)
Monotonic Reads
If a process reads the value of a data item x, any
successive read operations on x by that process will
always return that same value or a more recent value.
(26)
Monotonic Writes
A write operation by a process on a data item x is
completed before any successive write operation on x by
the same process
(27)
Read Your Writes
The effect of a write operation by a process on data item x
will always be seen a successive read operation on x by the
same process.
(28)
Writes Follow Reads
A write operation by a process on a data item x
following a previous read operation on x by the same
process, it is guaranteed to take place on the same or a
more recent value of x that was read.
(30)
Replica Placement
32
Replica Placement
Permanent replicas
◦ Initial set of replicas. Created and maintained by DDS-owner(s)
◦ Writes are allowed
◦ E.g., web mirrors
Server-initiated replicas
◦ Enhance performance
◦ Not maintained by owner of DDS
◦ Placed close to groups of clients
Manually
Dynamically
Client-initiated replicas
◦ Client caches
◦ Temporary
◦ Owner not aware of replica
◦ Placed closest to a client
◦ Maintained by host (often the client)
Permanent Replicas
• Permanent Replicas
– Initial set of replicas that constitutes a
distributed data store
(34)
Server-Initiated Replicas
• Server-Initiated Replicas
– Created at the initiative of the owner of the data
store
– Exist to enhance performance
• Work Scheme
How to decide where and when replicas should be created or deleted?
– Each server keeps track of access counts per file,
and where access requests come from.
– When a server Q decides to reevaluate the
placement of the files it stores, it checks the
access count for each file.
– If the total number of access requests for F at Q
drops below the deletion threshold del (Q,F), it
will delete F unless it is the last copy.
(35)
Client-Initiated Replicas
• Work Scheme
– When a client wants access to some data, it
connects to the nearest copy of the data store from
where it fetches the data it wants to read,
– When most operations involve only reading data,
performance can be improved by letting
the client store requested data in a nearby cache.
– The next time that same data needs to be read, the
client can simply fetch it from this local
cache.
• Client-Initiated Replicas
– Created at the initiative of clients
– Commonly known as client caches
(36)