Replication and Consistency CS4513 Distributed Computing Systems Slides
Replication and Consistency CS-4513 Distributed Computing Systems (Slides include materials from Operating System Concepts, 7 th ed. , by Silbershatz, Galvin, & Gagne, Distributed Systems: Principles & Paradigms, 2 nd ed. By Tanenbaum and Van Steen, and Modern Operating Systems, 2 nd ed. , by Tanenbaum) CS-4513 D-term 2008 Replication and Consistency 1
Problem • Given that synchronization and locking is so difficult, do we really need it in a distributed system? • Is there a better way? CS-4513 D-term 2008 Replication and Consistency 2
Example • Grapevine registry contains a list of items • Groups • Individuals • If we need to update one item, do we need to lock entire registry? • Where do we update that one item? • How does it get propagated to other replicas? CS-4513 D-term 2008 Replication and Consistency 3
Replication • The art and science of keeping multiple copies of data in a distributed system • Two reasons: – • Reliability • Performance CS-4513 D-term 2008 Replication and Consistency 4
Example 1 • Grapevine keeps replicas of each registry on at least three Registration Servers • At least one is located far away • Performance • Registries accessed frequently – spread the load • Updates happen often enough that locking a registry would be a real bottleneck • Reliability • Destination registry needed for sending a message • Even if a server is down or network is partitioned CS-4513 D-term 2008 Replication and Consistency 5
Example 2 • DNS (Domain Name Service) allows owner of a domain to replicate name database • Same two reasons • Performance • Reliability • Also • Scaling technique CS-4513 D-term 2008 Replication and Consistency 6
Replication • Data centric • I. e. , try to keep data consistent across replicas • Client centric • Weaker condition • Only maintain consistency for each client separately CS-4513 D-term 2008 Replication and Consistency 7
General Approach • Update a single item in local replica • Atomically • Time-stamp – e. g. , logical clock • Replica propagates update to all of its other replicas • Periodically • Receiving replica merges update with its own copy • Conflicting updates resolved arbitrarily to latest time -stamp CS-4513 D-term 2008 Replication and Consistency 8
Consistency • Strict consistency (in time) CS-4513 D-term 2008 • Not strict consistency Replication and Consistency 9
Consistency (continued) • All processes see updates in same order CS-4513 D-term 2008 • Processes see updates in opposite order! Replication and Consistency 10
Consider three processes • Three shared variables: x, y, z • Initialized to zero • Each updates one variable, and then reads and prints other two CS-4513 D-term 2008 Replication and Consistency 11
Of the 90 Valid Execution Sequences, here are four CS-4513 D-term 2008 Replication and Consistency 12
Causal Relationships • If A causes B to happen, then A should appear before B to all observers CS-4513 D-term 2008 Replication and Consistency 13
Summary • Can be very complicated • Textbooks go into much greater depth • Needed for particular distributed systems • Can be ignored in others • In Grapevine, update may not be reflected to updater! • Simply retry later. CS-4513 D-term 2008 Replication and Consistency 14
Reading • Tanenbaum & van Steen (2 nd ed. ) – Chapter 7 CS-4513 D-term 2008 Replication and Consistency 15
Questions? CS-4513 D-term 2008 Replication and Consistency 16
- Slides: 16