Title: Chapter 4. Consistency and Replication
1Chapter 4. Consistency and Replication
2Replication and Consistency
- Reasons for Replication
- Reliability
- Performance e.g. scalability
- Drawbacks
- Performance and Scalability to maintain
consistency - When updates take place more often than simple
accesses - Update propagation to maintain consistency
Replica
Replica
Update
Replica
3Example Shared Objects
- Handling concurrent accesses of a shared object
4Example Replicated Object
Distributed system is responsible for replica
management
Replication-Aware Distributed Objects
5Approach
- Goal
- Scalability by replication
- Without loss of consistency
- Problem
- Updates take long time to propagate them to
replicas - Approach A compromise
- Loosen consistency constraint
- Copies are not same at all time
- Classification
- Data Centric Approach Global Consistency
- Client Centric Approach Consistency to each
client
6Data-Centric Approach vs. Client-Centric
Approach
7Data-Centric Approach Strict Consistency
- Strict Consistency
- Any read on a data item x returns a value
corresponding to the result of the most recent
write on x. - But it is impossible to realize strict
consistency. Why ? - History order of executions (interleaved or not)
time
Strict Consistent
Not Strict Consistent
8Data-Centric Approach Sequential Consistency
- No matter what operations really take place
- cf. Strict Consistency
- Orders seen by different machine should be same
- Weaker than Strict Consistency
- What problems in realizing sequential consistency
? - Comparison with serializability
Sequentially Consistent
Sequentially Inconsistent
9Sequential Consistency Example
- 6!(720) orders wrt execution orders
- 64 results wrt print output
- 000000 not allowed, since no respect on
execution order - 001001 not allowed, since no respect on
sequential consistency
10Data-Centric Approach Causal Consistency
- Distinction between
- Concurrent operations not causally related
- Causally related operations
- Example. P1 W(x), P2 R(x), W(y)
- W(y) in P2 is causally related with R(x) in P2
- Causally Related Operations Should respect
order - Weaker than Sequential Consistency
Causally Consistent
11Data-Centric Approach FIFO Consistency
- Two types of writing orders
- Writing order in a machine
- Writing order in several machine
- FIFO Consistency
- Only respect writing order in a machine
- Weaker than Causal Consistency
12Data-Centric Approach Weak Consistency
- No consistency except Explicit Synchronization
Request - Synchronize Operation
- All writes on a machine should be propagated to
all copies - No operation on a synchronized variable is
allowed until all previous writes have completed
everywhere. - No read or write operations are allowed until
all previous operation to synchronization
variables have been completed
Weak Consistency
Not Weak Consistency
13Release Consistency and Entry Consistency
- Release Consistency
- Explicit Specification on Critical Section
- Acquire and Release
- Like Enter_CS and Leave_CS
- Programmer should specify
- Entry Consistency
- Like Release Consistency
- But explicit specification for each data item
14Summary of Data-Centric Consistency
15Eventual Consistency and Client-Centric
Consistency
- Rare Updates
- For a certain period of time, inconsistency can
be tolerated. - Client-Centric Consistency
- Lazy update propagation
16Client-Centric Consistency
- Client-Centric Consistency
- Not all copies must be consistent
- Consistency from the viewpoint of client (or
process) - Lazy update propagation
- Example Web pages
- Four types of Consistency
- Monotonic Read Consistency
- Monotonic Write Consistency
- Read-your-writes Consistency
- Writes-follow-reads Consistency
17Monotonic Read Consistency
- Guarantee
- If a read by a process returns a value, any
other reads by this process at a later time
should notreturn an old value - Suppose a mobile client, the order of reads by
this clientshould be respected the order
wherever it is. - Update Propagation for Read Order
- Mobile Client has consistent Read
Monotonic-Read Consistent
Not Monotonic-Read Consistent
18Monotonic Write Consistency
- Guarantee
- Order of writes by a same process wherever they
are performed - Suppose a mobile client, the order of writes by
this clientshould be respected the order
wherever it is. - Update Propagation for Write-Order
- Mobile Client has consistent Writes
Monotonic-Write Consistent
Not Monotonic-Write Consistent
19Implementation Issues Distribution Protocol
- Replication
- Deciding Where, When, and by Whom to duplicate
- Update Propagation
- A Conceptual Classification
20Server-Initiated Replication
- Server-Initiated Replicas
- Replicas made by server to enhance performance
- How to decide when and where ?
- Keep Access Count
- Del(S,F) Threshold for deleting a replica
- Rep(S,F) Threshold for making a replica
21Client-Initiated Replication
- Client caches
- on the client machine but not necessarily
- on a machine in its LAN
- Good when no update happens
- For a short time
- Cache Replacement
- Hit Ratio
22Update Propagation
- State vs. Operation What to propagate ?
- Notification of update
- Transfer new data
- Update Operation
- Pull vs. Push Protocol
- Push Protocol (Server-based Protocol)
- Updates are propagated to other copies WITHOUT
requests - Often between Permanent and Server-initiated
Copies - When High Degree of Consistency is required
- Pull Protocol (Client-based Protocol)
- Update propagation when requested
- Often client cache
- When Read-to-update ratio is low
23Comparison of Push and Pull Protocol
- Comparison
- Uni-casting vs. Multicasting
- Multicasting is convenient for push protocol