0% found this document useful (0 votes)
22 views16 pages

Chapter 5

Distributed system

Uploaded by

habtamu molla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views16 pages

Chapter 5

Distributed system

Uploaded by

habtamu molla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Chapter Five

Client-Centric Consistency Models

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

 A mobile user accessing different replicas of a distributed database has


problems with eventual consistency.
 Note: Under eventual consistency, if no new updates are made to a data
item, all replicas will eventually become consistent. However, if updates
continue, there may be temporary inconsistencies between replicas.
6 11/13/2024
Monotonic Reads
 Monotonic reads ensure that if a process reads the value of a data
item 𝑥 at time 𝑡, any subsequent reads of 𝑥will always return that same
value or a more recent one.
 It guarantees that a process will never see an older version of 𝑥 after
reading it.
 Example: Consider a distributed email system where a user's mailbox is
replicated across multiple machines.
 If a user reads their mail in San Francisco, and later accesses it from
New York, monotonic-read consistency ensures that the messages seen
in San Francisco will also be available when they open their mailbox in
New York, even if updates are propagated lazily across the system.

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

 Figure (a) – a data store that is monotonic-write consistent


 P performs a write operation on x at L1, W(x1). Later, P performs a
write operation on x at L2, W(x2)
 W(x2) requires that W(x1) is updated on L2 before it.
 Figure (b) – a data store that is not monotonic-write consistent
 W(x1) has not been propagated to L2

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

 Figure (a) – a data store that is read-your-writes consistent


 P performs a write operation on x at L1, W(x1). Later, P performs a
read operation on x at L2, R(x2).
 WS(x1;x2) states that W(x1) is part of WS(x2).
 Figure (b) – a data store that is not read-your-writes consistent
 W(x1) is left out of WS(x2). That is, the effects of the previous write
operation by process P have not been propagated to L2.
 Example: Updating your Web page and guaranteeing that your Web
browser shows the newest version instead of its cached copy.
12 11/13/2024
Writes follow Reads
 Writes Follow Reads is a consistency model that guarantees that once a
client reads a value, any subsequent writes to the same data item by that
client will follow the value that was read.
 This model ensures that the client’s updates are logically connected to
their previous reads, preventing situations where a write might overwrite
data that the client has not seen.
 A data store is said to be writes-follow-reads consistent if the following
condition holds:
 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.
 That is, any successive write operation by a process on a data item x will
be performed on a copy of x that is up to date with the value most
recently read by that process.
13 11/13/2024
Writes follow Reads

 Figure (a) – a data store that is writes-follow-reads consistent


 P performs a read operation on x at L1, R(x1).
 The write operations that led to R(x1), also appear in the write set at
L2, where P later performs W(x2).
 Figure (b) – a data store that is not writes-follow-reads consistent
 The write operations that led to R(x1), did not appear in the write set
at L2, before P later performs W(x2).
 Example: Writes-follow-reads consistency can be used to guarantee that
users of a network newsgroup see a posting of a reaction to an article
14 only after they have seen the original article. 11/13/2024
Client Centric Consistency model summary
 Eventual Consistency: is a consistency model in distributed systems where all
replicas of a data item will eventually converge to the same value, but there’s
no guarantee when this will happen. It allows temporary inconsistencies,
meaning different nodes may return different values until updates are fully
propagated.
 Monotonic read: If a process reads the value of a data item x, any successive
read operation on x by that process will always return that same value or a
more recent value
 Monotonic write: A write operation by a process on a data item x is completed
before any successive write operation on x by the same process
 Read your writes: The effect of a write operation by a process on a data item x
will always be seen by a successive read operation on x by the same process
 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, is guaranteed to take place
on the same or more recent values of x that was read
15 11/13/2024
i o n!
te nt
r a t
y o u
s fo r
a nk
Th

16 11/13/2024

You might also like