Docsity

Distributed Software Development: Replication, Study notes of Software Engineering

Partial preview of the text

Download Distributed Software Development: Replication and more Study notes Software Engineering in PDF only on Docsity!

Distributed Software Development

Replication

Chris Brooks

Department of Computer Science

University of San Francisco

Department of Computer Science — University of San Francisco – p. 1/

Previously on cs682: Causal delivery

-^

causal delivery

says that if

send

(m

send

(m

, then

deliver

(m

(m

when different processes are sending

m

1

and

m

-^

Logical clocks aren’t enough to give us causal delivery.

Department of Computer Science — University of San Francisco – p. 2/

Previously on cs682: Vector Clock example

p^1 p^2 p^3

(1,0,0) (0,1,0) (0,0,1)

(2,1,0) (1,0,2)(1,0,3) (1,0,4)

(3,1,3)

(1,2,4)

(4,1,3)

(4,3,4) (1,0,5)

(5,1,6)

(5,1,3)

(6,1,3)

Department of Computer Science — University of San Francisco – p. 4/

Previously on cs682: Consensus

-^

If we don’t have reliable communication, consensus isimpossible, even without failures.

-^

With reliable communication, we can solve consensus for crashfailures.

-^

In asynchronous systems, it is impossible to guarantee that wewill reach consensus, even in the presence of a single crashfailure.

-^

This means that we can’t do:^ ◦

Asynchronous Byzantine generals ◦ Asynchronous totally ordered multicast

Department of Computer Science — University of San Francisco – p. 5/

Why is replication useful?

-^

Increased performance.^ ◦

By moving data closer to a client, latency is reduced. ◦ Web caching, proxy servers are an example of this.

-^

Performance is improved most effectively with immutable data.^ ◦

If the client is going to change the data and send it back,performance gains are reduced.

Department of Computer Science — University of San Francisco – p. 7/

Why is replication useful?

-^

Increased availability.

-^

Many services need to be highly available

-^

Replication provides a way of overcoming server failures.

-^

If a server will fail with probability

p

, then we can determine how

many servers are needed to provide a given level of service:^ ◦

Avail

p

n

-^

For example, if a server has a 5% chance of failure (i.i.d) over agiven time period, and we want 99.9% availability, we need atleast 4 replicas.

Department of Computer Science — University of San Francisco – p. 8/

Fault tolerance

-^

Highly available data may not be correct data.^ ◦

For example, in the presence of network outages.

-^

Fault tolerance guarantees correct behavior in the presence ofa given number of faults.

-^

Similar to availability, but a coordination element is alsorequired.

-^

We may also want to ensure against corruption of data.

Department of Computer Science — University of San Francisco – p. 10/

Outline

-^

Passive Replication^ ◦

What problems must be solved for this?

-^

Active Replication^ ◦

What problems must be solved for this?

-^

Lazy Replication^ ◦

What problems must be solved for this?

Department of Computer Science — University of San Francisco – p. 11/

System Model

Client Client

FrontEnd FrontEnd

RM RM

RM

RM

-^

Clients interact with replicamanagers via a front end.

-^

Front end hides replicationfrom the client.

-^

Front end may interact withall replica managers, or justa subset.

-^

Replica

managers

interact

to ensure consistency.

Department of Computer Science — University of San Francisco – p. 13/

Fault tolerance example

-^

Consider this example:^ ◦

We have a bank with two replicated servers: a user’s frontend may connect to either one. ◦ First, a user updates account A via server 1 to contain $10. ◦ Next, the user transfers $5 from A to account B via server 2. ◦ Server 1 fails before data is propagated. ◦ The bank manager logs into server 2 and sees that accountA has a balance of 0 and account B has a balance of $5.

-^

Problem: even though the transfer happened after the deposit,it is the only operation seen.

Department of Computer Science — University of San Francisco – p. 14/

Passive Replication

Client Client

FrontEnd FrontEnd

BackupRM PrimaryRM

BackupRM

BackupRM

-^

Passive replication uses asingle replica manager.

-^

Other replica managers actas backups (or slaves).

-^

Primary manager executesoperations and sendscopies of updated data tobackups

-^

If primary fails, a new one iselected.

Department of Computer Science — University of San Francisco – p. 16/

Passive Replication

-^

Sequence of events:1. Front end issues a request to primary2. Primary takes requests in FIFO order. Checks to see if

request has already been serviced. If so, re-send response.

  1. Execute request and store response.4. If data is updated, send updates to all backups. All backups

acknowledge.

  1. Response is sent to client.

Department of Computer Science — University of San Francisco – p. 17/

Group Communication

-^

Updating replicas is a

group communication

problem.

-^

If groups can change dynamically, then a group membershipservice is needed.

-^

This keeps track of the processes that are currently in a group.

Department of Computer Science — University of San Francisco – p. 19/

Group membership

-^

A group membership process needs to:^ ◦

Provide an interface for membership changes, creation, anddestruction. ◦ Provide a failure detector ◦ Notify members of membership changes. ◦ Perform group address expansion. When a message is sentvia multicast, it is sent to the group address. Themembership process must then deliver that message to allprocesses.

Department of Computer Science — University of San Francisco – p. 20/