Ch07 Ts Tk Consistency Replication
Ch07 Ts Tk Consistency Replication
REPLICATION
Thanks to the authors of the textbook [TS] for providing the base slides. I made several changes/additions.
These slides may incorporate materials kindly provided by Prof. Dakai Zhu.
So I would like to thank him, too.
Turgay Korkmaz
korkmaz@cs.utsa.edu
REPLICA MANAGEMENT
Replica-Server Placement, Content Replication and Placement
Content Distribution
CONSISTENCY PROTOCOLS
Continuous Consistency
Primary-Based Protocols
Replicated-Write Protocols
Cache-Coherence Protocols
Implementing Client-Centric Consistency
Distributed Systems 1.2 TS
Objectives
Problems
How to keep replicas consistent
Distribute
replicas
Propagate modifications
CONSISTENCY MODELS
A data store is a
distributed
collection of
storages, R-W
System-wide
consistency
A contract between a (distributed) data store and
processes, in which the data store specifies precisely
what the results of read and write operations are in the
presence of concurrency. Read the last write!
Without a global clock, it is hard to define precisely which write is the last
one! So we need other definitions [degree/range of consistency]
Distributed Systems 1.7 TS
Continuous Consistency
We can actually talk about a degree of consistency:
replicas may differ in their numerical value
replicas may differ in their relative staleness
there may be differences with respect to number and
order of performed update operations
Examples
Replication of stock market prices (e.g., no more than
$.02 or 0.5% difference between any two copies)
Duration of updates (e.g., weather reports stay accurate
over some time, web pages)
Order of operations could be different (e.g., see next slide)
CONSISTENT ORDERING OF
OPERATIONS
CLIENT-CENTRIC
CONSISTENCY MODELS
Eventual consistency:
If no updates take place for a long time, all
replicas will become consistent
Distributed Systems 1.20 TS
Eventual Consistency (2)
As long as a client access the
B
same replica, then there is
no problem…
But when the client (mobile
one) accesses different A
(a) A monotonic-read consistent (b) A data store that does not provide
data store monotonic reads.
IMP: When a client reads from a server, that server gets the clients R set to check if
all Ws have taken place locally. If not, it contacts the other servers to ensure that
it is brought up to date before read operation
Example 1: Automatically reading your personal calendar updates from different servers. Monotonic Reads guarantees
that the user sees all updates, no matter from which server the automatic reading takes place.
Example 2: Reading (not modifying) incoming mail while you are on the move. Each time you connect to a different e-
mail server, that server fetches (at least) all the updates from the server you previously visited.
Distributed Systems 1.23 TS
Monotonic Writes
In a monotonic-write consistent store, the following condition holds:
(a) A data store that provides (b) A data store that does not.
read-your writes consistency.
Example: Updating your Web page and guaranteeing that your Web browser shows
the newest version instead of its cached copy.
(a) A writes-follow-reads consistent (b) A data store that does not provide
data store. writes-follow-reads consistency.
Example: See reactions to posted articles only if you have the original posting (a read
“pulls in” the corresponding write operation).
Distributed Systems 1.26 TS
Where, when, and by whom replicas should be placed and
Which mechanisms to use for keeping them consistent?
Placement of
Servers (find the best location)
Content (find the best server)
REPLICA MANAGEMENT
Client caches
Local storage, management is left to client
Keep it for a limited time
For consistency client may want server to cooperate
(modified-since-then.. In HTML)
Cache hit rate is important for performance
Server-initiated is becoming more common than
client-initiated…. Why?
CONTENT DISTRIBUTION
What is to be propagated:
1. Propagate only a notification of an update.
Invalidation protocols use notifications to inform others
+ little network overhed
+/-
N separate send vs. one send to N servers
Pull-based--- unicast
Push-based– multicast (broadcast in LAN)
CONSISTENCY PROTOCOLS
Remote-Write Protocols
Local-Write Protocols
PRIMARY-BASED
PROTOCOLS
Active Replication
Quorum-Based Protocols
REPLICATED-WRITE
PROTOCOLS
CLIENT-CENTRIC
CONSISTENCY
CONTINUOUS CONSISTENCY
General Approach:
Let every server Sk maintain a view TWk[i, j] of
what it believes is the value of TW[i, j].
Note that:
This information can be gossiped when an update
is propagated.
Solution
Sk sends operations from its log Lk to Si when it
sees that TWk[i,k] is getting too far from TW[k,k], in
particular, when TW[k,k]−TWk [i,k] > i / (N −1).
CACHE-COHERENCE
PROTOCOLS
Write-through cache
Clients modified cached data and forward updates to
server
Similar to primary-based local write (clients cache is
temp-primary)
Client should have exclusive write permission to avoid w-
w conflicts
Write-back cache
Group multiple updates to further improve performance
Used in distributed file systems…