6 Replication Nhom3
6 Replication Nhom3
6 Replication Nhom3
Systems
TS. Phan Thị Hà
◼ Why replicate?
❑ System availability
◼ Avoid single points of failure
❑ Performance
◼ Localization
❑ Scalability
◼ Scalability in numbers and geographic area
❑ Application requirements
◼ Why not replicate?
❑ Replication transparency
❑ Consistency issues
◼ Updates are costly
◼ Availability may suffer if not careful
x1 x2 … xn
◼ Mutual Consistency
❑ How do we keep the values of physical copies of a logical data
item synchronized?
❑ Strong consistency
◼ All copies are updated within the context of the update transaction
◼ When the update transaction completes, all copies have the same
value
◼ Typically achieved through 2PC
❑ Weak consistency
◼ Eventual consistency: the copies are not identical when update
transaction completes, but they eventually converge to the same
value
◼ Many versions possible:
❑ Time-bounds
❑ Value-bounds
❑ Drifts
© 2020, M.T. Özsu & P. Valduriez TS.
8
Phan Thị Hà
Transactional Consistency
Site A Site B
x x
Eager
Lazy
◼ Changes are propagated within the scope of the transaction making the
changes. The ACID properties apply to all copy updates.
❑ Synchronous
❑ Deferred
◼ ROWA protocol: Read-one/Write-all
Transaction
updates commit
● Lazy replication first executes the updating transaction on one copy. After
the transaction commits, the changes are propagated to all other copies
(refresh transactions)
● While the propagation takes place, the copies are mutually inconsistent.
● The time the copies are mutually inconsistent is an adjustable parameter
which is application dependent.
Transaction
updates commit
Site 1 Site 2 Site 3 Site 4
● There is only one copy which can be updated (the master), all others
(slave copies) are updated reflecting the changes to the master.
● Changes can be initiated at any of the copies. That is, any of the
sites which owns a copy can update the value of the data item.
Transaction
updates commit
Transaction
updates commit
❑ Replication Protocols
❑
Centralized Distributed
© 2020, M.T. Özsu & P. Valduriez TS.
20
Phan Thị Hà
Eager Centralized Protocols
◼ Design parameters:
❑ Distribution of master
◼ Single master: one master for all data items
◼ Primary copy: different masters for different (sets of) data items
❑ Level of transparency
◼ Limited: applications and users need to know who the master is
❑ Update transactions are submitted directly to the master
❑ Reads can occur on slaves
◼ Full: applications and users can submit anywhere, and the
operations will be forwarded to the master
❑ Operation-based forwarding
◼ Four alternative implementation architectures, only three
are meaningful:
❑ Single master, limited transparency
❑ Single master, full transparency
❑ Primary copy, full transparency
© 2020, M.T. Özsu & P. Valduriez TS.
21
Phan Thị Hà
Eager Single Master/Limited
Transparency
◼ Applications submit update transactions directly to the master
◼ Master:
❑ Upon read: read locally and return to user
❑ Upon write: write locally, multicast write to other replicas (in FFO timestamps order)
❑ Upon commit request: run 2PC coordinator to ensure that all have really installed the
changes
❑ Upon abort: abort and inform other sites about abort
◼ Slaves install writes that arrive from the master
2
Eager Primary Copy/Full Transparency
◼ Critical issue:
❑ Concurrent Writes initiated at different master sites are executed in the
same order at each slave site
❑ Local histories are serializable (this is easy)
◼ Advantages
❑ Simple and easy to implement
◼ Disadvantage
❑ Very high communication overhead
◼ n replicas; m update operations in each transaction: n*m messages (assume
no multicasting)
◼ For throughput of k tps: k* n*m messages
◼ Alternative
❑ Use group communication + deferred update to slaves to reduce
messages
Centralized Distributed