• Tidak ada hasil yang ditemukan

Chapter 7 Consistency And Replication (2)

N/A
N/A
Protected

Academic year: 2019

Membagikan "Chapter 7 Consistency And Replication (2)"

Copied!
23
0
0

Teks penuh

(1)

DISTRIBUTED SYSTEMS

Principles and Paradigms

Second Edition

ANDREW S. TANENBAUM

MAARTEN VAN STEEN

Chapter 7

(2)

Plan

Motivation

Consistency models

Data-centric consistency

Client-centric consistency

Replica management

(3)

Consistency Protocols

Describe algorithm for

achieving a given

consistency model

Data-centric

(4)

Continuous Consistency

Bounding deviations

so as to avoid

Numerical errors

E.g., that deviation of

replicas’ stock quote is

more than 1.00$

Staleness errors

E.g., that last stock

quote is more than 1

hour old

Order errors

(5)

Bounding Numerical Deviation

Assume

N servers,

S

1

… S

N

Single data item

x

A write,

W(x),

has a weight,

weight(W)

, that is the amount that

x

changes

E.g.,

x = 1; x := x * 3

<- weight is …

2

weight(w) > 0

We have a limit on numerical deviation for the value of

x

,

v

i

, at

server

S

i

W(x)

x1

x2

x3

origin(W)

W(x)

W(x)

L1

L2

L3

Log of writes

performed

i

δ

(6)

Bounding Numerical Deviation

Define

I.e., sum of writes executed by

S

i

originating from

S

j

Note,

T[i,i]

are all values submitted by

S

i

W(x)

x1

x2

x3

origin(W)

W(x)

W(x)

L1

L2

L3

Log of writes

performed

=

=

{

(

)

|

(

)

}

]

,

(7)

Bounding Numerical Deviation

Define

Goal

(8)

Bounding Numerical Deviation

Assume

S

i

also sends

TW[i,k]

to

S

k

S

k

maintains this as a view,

TW

k

[i,k]

, of what

S

i

has

seen from

k

If then

S

k

forwards writes

from its log,

L

k

S

k

waits to commit new writes until these are

commited at

S

i

Guarantees that deviation is bounded as

(9)
(10)

Bounding Staleness Deviations

Goal

Ensure that there are no

W(x)

older than

TO

i

that

S

i

has not seen

”Older than”?

Vector clocks?

If we know drift rate of clocks and communication

delay, we can synchronize within a bound

W(x)

x1

x2

x3

origin(W)

W(x)

W(x)

L1

L2

L3

(11)

Bounding Staleness Deviations

In any case

Keep a real-time vector clock

VT

k

[i]

= Local time of last write from

S

i

If

|VT

k

[i] – T(k)| > TO

i

pull updates from

S

i

W(x)

x1

x2

x3

origin(W)

W(x)

W(x)

L1

L2

L3

(12)

Bounding Ordering Deviations

Check size of local queue of tentative updates

Updates may not have been committed due to

ordering constraints

If too large, try to agree on ordering of updates

before proceeding…

Ensuring consistent ordering

W(x)

x1

x2

x3

origin(W)

W(x)

W(x)

L1

L2

L3

(13)

Ensuring Consistent Ordering

Make a specific process responsible for

specific data item

Primary-Based Protocols

Enable multiple processes to carry out

write operations

(14)

Remote-Write Protocols

(15)

Local-Write Protocols

(16)

Replicated-Write: Active Replication

Multicast updates to

all replicas

Need ordering of

multicast

May be inefficient

Combine

primary-based (”token-site”)

and replicated-write

(”symmetric”)protocols

Use

primary-based

Use

replicated-write

Largest inter-message

(17)

Replicated-Write: Quorum

Multicast W(x), read x

Has the write been committed?

Is the value read up-to-date?

Static process group

Basic idea

Write (version(x), value(x))

When writing new version, get more than half of the

processes to approve

When reading, get response with latest version from more

than half of the processes

Avoid write/write conflicts

Avoid write/read conflicts

(18)

Replicated-Write: Quorum

Process group of size

N

Define

write quorum

size,

N

W

At least

N

W

processes need to agree on value and

version for us to read

read quorum

size,

N

R

At least

N

R

processes need to agree on value and

version for us to read

To make sure to read latest version

N

W

+ N

R

> N

N

W

+ N

W

> N

At least half of the processes

will have latest version

At least one process

(19)

Quorum-Based Protocols

Figure 7-22. Three examples of the voting algorithm.

(a) A correct choice of read and write set. (b) A choice

that may lead to write-write conflicts. (c) A correct

(20)

Client-Centric Consistency

Each client keeps track of

Read set:

identifiers of the writes

that are relevant to the read

operations performed by the

client

Write set

: identifiers of writes

performed by the client

Monotonic-read consistency

Read performed

Client hands in

read set

to

server

Server may need to

communicate with other server

to become up-to-date

Server returns updated

read set

Write performed

(Nothing particular)

(21)

Client-Centric Consistency

Monotonic-write consistency

Write

Client hands in

write set

to server

Server may need to communicate with

other server to become up-to-date

Server returns updated

write set

Read-your-writes consistency

Read

Client hands in

write set

to server

Server may need to communicate with

other server to become up-to-date

Server returns updated

write set

Writes-follow-reads consistency

Client hands in

write set

and

read set

to

server

Server may need to communicate with

other server to become up-to-date with

read set

Add identifiers from the

read set

to the

write set

(22)

Client-Centric Consistency

Efficiency?

Bound size of writes and

reads by grouping operations

into

sessions

E.g., clear sets when a client

exits a specific application

Use a vector timestamp…

WVC

i

[j]: the timestamp of the

latest write operation from S

j

that

S

i

has processed

SVC

A

[j]: the timestamp of the

latest write operation in the

session that originates from S

j

(23)

Summary

Various protocols for ensuring consistency

Data-centric consistency

Primary-based protocols

Replicated-write

Primary-based protocols most widely used due

to simplicity

Exact selection of protocol type depends on rate at

which request are processed and on message delay

Client-centric consistency may be efficiently

Referensi

Dokumen terkait

• A test case is a set of test data or situations that will be used to exercise the unit (class, subsystem, system) being tested or about the attribute being measured 4. Create

Read User command Read System data Invoke Command processing Build Configuration file Activate/ Deactivate system Display Messages And status Read password Compare Password With

Record your voice while reading Topic 2: Fighting Spam ..\Week 3_Fighting Spam\ppt_Fighting Spam Reading 1to3.pptx - Write down the minutes you spent reading and the date in the

reading and writing activities and finally the role of parents as motivators and advisors, namely to help children stay enthusiastic in learning to read and write so as not to give

TheAssertclass provides several functions to help you test the state of your program as it runs: Assert public class Assert { static public void preboolean test, String message //

Chapter 2: LinkedIn Nuts and Bolts In This Chapter ✓ Expanding your network ✓ Exploring LinkedIn features ✓ Sending and receiving messages ✓ Managing LinkedIn correspondence ✓

The specific terms should be set down on paper:  The financial statements to be audited  The purpose of the audit  The professional standards to be followed by the auditor 

address this question, we performed a correlation analysis on a data set that included the yield at several ∆Mo valuescalculated from the two-product model fit, carbon number within the