consistency and replication
consistency and replication
Introduction
Why Replication
Enhance reliability
Improve performance
Two issues
Placement of replicas & how updates are
propagated
How replicas are kept consistent
Object Replication
Replicate objects instead of only data.
Benefit:
Encapsulation since only can be accessed via predefined
interface
But, before considering replication, we need so solve
how to protect object from multiple-access?
Object itself implement the means
Synchronized method in Java
Completely unprotected but objects adapter
E.g., object adapter uses a single thread per object
See the following next slide
Problem : Concurrent Object Access
3rd point: when data item are accessed (read or write), all
previous synchronization will have been completed
Weak Consistency (Cont.)
Enforce consistency on a group of operations
Suitable when most accesses coming in clusters
Replica Placement
Update Propagation
Epidemic Protocols
Eventual Consistency: Mobile
Problems
Replica Placement
Update Propagation
Epidemic Protocols
Eventual Consistency: Mobile
Problems
Multicast
Sending a message efficiently to multiple
receivers if multicasting facilities is available.
Chapter 6.4.Distribution Protocols
In this section
Discuss ways to propagate updates to replicas
Replica Placement
Update Propagation
Epidemic Protocols
Epidemic Protocols
For some data stores, provide only eventual
consistency is sufficient
All replicas are eventually identical
Update propagation in eventual-consistency is
implemented by an epidemic protocols
Do not solve any update conflicts
Only concern propagating updates to all replicas in as few
messages as possible.
Suitable for eventual consistency model
Assume all updates for a specific data item are
initiated at a single server.
Eventual Consistency: Mobile
Problems
Primary-Based Protocols
Remote-Write Protocols
Local-Write Protocols
Replicated-Write Protocols
Cache-Coherence Protocols
Primary-Based Protocols
Each data item is associated with a primary.
The primary is responsible for coordinating
writes to the data item.
There are two types of Primary-Based
Protocol,
Remote-Write Protocols
Local-Write Protocols
Remote-Write Protocols
With this protocol, there are two variants
All reads/writes are performed at a single (remote)
server.
This model is typically associated with traditional
client/server systems
Writes are still centralized, but reads are now
distributed.
The primary coordinates writes to each of the
backups.
Called primary-backup protocols
Remote-Write Protocols (1)
Primary-Based Protocols
Remote-Write Protocols
Local-Write Protocols
Replicated-Write Protocols
Cache-Coherence Protocols
Replicated-Write Protocols
With these protocols, writes can be carried out at
multiple replica, instead of one in primary-based
replicas
Another name might be: ³Distributed-Write
Protocols´
There are two types:
Active Replication.
An operation is forwarded to all replicas
Quorum-Based Protocol
By Majority Voting
Active Replication
A special process carries out the update operations at
each replica
Updates are propagated to each replica
Problem
Operation must be carried out in the same order everywhere
Sol 1. totally-ordered multicast
Lamport¶s timsestamps can be used to achieve total ordering, but this
does not scale well
Sol 2. by a central coordinator called sequencer
Assigns a unique ID# to each update, which is then propagated to all
replicas, but still does not scale well
Also strongly resemble primary-based consistency protocol
replicated invocations: next slide
Active Replication: The Problem
Primary-Based Protocols
Remote-Write Protocols
Local-Write Protocols
Replicated-Write Protocols
Cache-Coherence Protocols
Cache-Coherence Protocols
Ensure a client cache is consistent with the
server-initiated replicas
Coherence Detection Strategy
When inconsistencies are detected
Coherence Enforcement Strategy
Determine how caches are kept consistent with
the copies stored at servers
Coherence Detection Strategy
When inconsistencies are actually detected ?
Statically at compile time:
Perform analysis prior to execution
If may lead to inconsistencies
Insert extra instructions to avoid inconsistency.
Used in conventional computer systems
Dynamically at runtime: check with the server
Applied in distributed system
Coherence Detection Strategy (Cont.)
Runtime checking example: a distributed database
There are three different approaches
Before start transaction, must verify first
Transaction cannot proceed until its consistency has been
validated.
Let the transaction proceed while verification is taking
place.
An optimistic approach
Assume cached data is up-to-date, but abort if assumption wrong
Verify the cached data only when the transaction
committed
Also an optimistic approach
Coherence Enforcement Strategy
How are caches kept consistent with copies in
server ?
Server send invalidation to all caches when a data
item is modified.