Chapter 5
Chapter 5
1 11/13/2024
Contents
Introduction to Consistency Model
Eventual Consistency
Monotonic Reads
Monotonic Writes
Read Your Writes
Writes follow Reads
2 11/13/2024
Introduction to Consistency Model
In distributed systems, consistency refers to how data is synchronized
and shared across multiple nodes or processes.
A consistency model defines the rules and guarantees about how
operations on shared data appear to different clients, ensuring that
clients' views of data are coherent and predictable.
Different systems and use cases require different consistency models
based on performance, availability, and fault-tolerance trade-offs.
Consistency models determine how updates to shared data are
propagated and when and how a read operation reflects these updates.
Client-centric consistency models focus on the consistency of data
from the perspective of individual clients (or processes), ensuring that
clients observe data in a predictable way.
3 11/13/2024
Introduction to Consistency Model
Client-centric consistency models are generally used for applications
that lack simultaneous updates – i.e., most operations involve reading
data. Only few processes involve in updates.
It concentrates on what specific clients want, instead of what should be
maintained by servers.
Common client-centric consistency models include:
Eventual Consistency
Monotonic Reads
Monotonic Writes
Read Your Writes
Writes Follow Reads
These models are often designed to provide a balance between
availability and latency in distributed systems, particularly when full
4 synchronization (strong consistency) is too costly or impractical.
11/13/2024
Eventual Consistency
In many cases concurrency appears only in restricted form. In many
applications most processes only read data. In some cases if for a long
time no update takes place all replicas gradually and eventually become
consistent. It is called eventual consistency.
Clients access distributed data store using, generally, the local copy.
Updates are eventually propagated to other copies.
Eventual consistency essentially requires only that updates are
guaranteed to propagate to all replicas. However, problems arise when
different replicas are accessed over a short period of time.
For example, for the mobile user example, eventual consistent data
stores will not work properly
5 11/13/2024
Eventual Consistency
7 11/13/2024
Monotonic Reads
Example: The read operations are performed by a single process P at two different local
copies (L1 & L2) of the same data store
Notation: WS(xi[t]) is the set of write operations (at Li) that lead to version xi of x (at
time t): WS(xi[t1];xj [t2]) indicates that it is known that WS(xi[t1]) is part of WS(xj[t2])
Note: Parameter t is omitted from figures
To guarantee monotonic-read consistency, all operations in WS(x1) should have been
propagated to L2 before the second read operation takes place. In other words, we need
to know for sure that WS(x1) is part of WS(x2) which is expressed as WS(x1;X2).
A monotonic-read consistent data store.
A data store that does not provide monotonic reads
8 11/13/2024
Monotonic Writes
Monotonic Writes ensures that writes from the same client are applied in
the same order across all replicas.
This prevents the issue where different replicas might apply the same
client’s writes in a conflicting or out-of-order manner.
A data store is said to be monotonic-write consistent if the following
condition holds:
A write operation by a process on a data item x is completed before any
successive write operation on x by the same process.
That is, a write operation on a copy of data item x is performed only if
that copy has been brought up to date by means of any preceding write
operations, which may have taken place on other copies of x.
9 11/13/2024
Monotonic Writes
10 11/13/2024
Read Your Writes
The Read Your Writes consistency model guarantees that after a client
writes a value to a data item, any subsequent reads by the same client
will reflect that write, ensuring that the client always sees its own
updates immediately.
A data store is said to be read-your-writes consistent if the following
condition holds:
The 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.
That is, a write operation is always completed before a successive read
operation by the same process, no matter where that read operation takes
place.
11 11/13/2024
Read Your Writes
16 11/13/2024