Presentation is loading. Please wait.

Presentation is loading. Please wait.

Replication (1). Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures.

Similar presentations


Presentation on theme: "Replication (1). Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures."— Presentation transcript:

1 Replication (1)

2 Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures

3 Readings r Van Steen and Tanenbaum: 6.1, 6.2 and 6.3, 6.4 r Coulouris: 11,14

4 Why Replicate? r Fault-tolerance / High availability m As long as one replica is up, the service is available m Assume each of n replicas has same independent probability p to fail. Availability = 1 - pn Fault-Tolerance: Take-Over

5 Why Replicate? (II) r Fast local access m Client can always send requests to closest replica m Goal: no communication to remote replicas necessary during request execution m Goal: client experiences location transparency since all access is fast local access Fast local access Toronto Beijing Dubai

6 Why Replicate? r Scalability and load distribution m Requests can be distributed among replicas m Handle increasing load by adding new replicas to the system cluster instead of bigger server

7 Common Replication Examples r DNA naming service r Web browsers often locally store a copy of a previously fetched web page. m This is referred to as caching a web page. r Replication of a database r Replication of game state r Google File System (GFS)

8 System Model FE Requests and replies C Replica C Service Clients Front ends managers RM FE RM Clients’ request are handled by front ends. A front end makes replication transparent.

9 Developing Replication Systems r Consistency r Faults r Changes in Group Membership

10 Example of Data Inconsistency r Assume x = 6 r Client operations: m write(x = 5) m read (x) // should return 5 on a single- server system r Assume 3 replicas: R1,R2,R3

11 Example of Data Inconsistency r Client executes write (x = 5) r We want x = 5 at R1,R2,R3 r The write requires network communication m Assume a message is sent to each replica indicating that x=5 BTW, this is multicasting r The amount of time it takes for a message to get to a replica varies

12 Example of Data Inconsistency r R1 receives message m x is now 5 at R1 r A client executes read (x) m The read causes a message to be sent to R2 r If R2 hasn’t received the update message then R2 sends the old value of x (which is 6)

13 Example Scenario r Replicated accounts in New York(NY) and San Francisco(SF) r Two transactions occur at the same time and multicast m Current balance: $1,000 m Add $100 at SF m Add interest of 1% at NY m If not done in the same order at each site then one site will record a total amount of $1,111 and the other records $1,110.

14 Example Scenario r Updating a replicated database and leaving it in an inconsistent state.

15 Strict Consistency r Strict consistency is defined as follows: m Read is expected to return the value resulting from the most recent write operation m Assumes absolute global time m All writes are instantaneously visible to all r Suppose that process p i updates the value of x to 5 from 4 at time t 1 and multicasts this value to all replicas m Process p j reads the value of x at t 2 (t 2 > t 1 ). m Process p j should read x as 5 regardless of the size of the (t 2 -t 1 ) interval.

16 Strict Consistency r What if t 2 -t 1 = 1 nsec and the optical fiber between the host machines with the two processes is 3 meters. m The update message would have to travel at 10 times the speed of light m Not allowed by Einsten’s special theory of relativity. r Can’t have strict consistency

17 Sequential Consistency r Sequential Consistency: m The result of any execution is the same as if the (read and write) operations by all processes on the data were executed in some sequential order m Operations of each individual process appears in this sequence in the order specified by is programs.

18 Example Scenario r Banking operation r We must ensure that the two update operations are performed in the same order at each copy. r Although it makes a difference whether the deposit is processed before the interest update or the other way around, it does matter which order is followed from the point of view of consistency.

19 Causal Consistency r Causal Consistency: That if one update, U1, causes another update, U2, to occur then U1 should be executed before U2 at each copy. r Application: Bulletin board

20 FIFO Consistency r Writes done by a single process are seen by all other processes in the order in which they were issued r … but writes from different processes may be seen in a different order by different processes. r i.e., there are no guarantees about the order in which different processes see writes, except that two or more writes from a single source must arrive in order.

21 FIFO Consistency r Caches in web browsers m All updates are updated by page owner. m No conflict between two writes m Note: If a web page is updated twice in a very short period of time then it is possible that the browser doesn’t see the first update.

22 Implementation Option: Sequential Consistency r Have a centralized process that is a sequencer. r Each update request is sent to the sequencer which m Assigns the request a unique sequence number m Update request is forwarded to each replica m Operations are carried out in the order of their sequence number

23 What about the other models? r Good question r We will get to those later

24 Faults r The use of the sequencer is interesting but r What if the sequencer fails? m One technique is an election algorithm Selects a new sequencer Very well studied m However, we will see that Google’s File System (GFS) uses a different (and simpler) approach r What if one of the replica’s fail? m Lots of solutions

25 Design Considerations r Where to submit updates? m A designated server or any server? r When to propagate updates? r How many replicas to install?

26 Summary r We have given you a taste of some of the issues r Let’s look at how Google deals with these issues in its file system


Download ppt "Replication (1). Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures."

Similar presentations


Ads by Google