mc714: sistemas distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · mc714:...

38
MC714: Sistemas Distribu´ ıdos Prof. Lucas Wanner Instituto de Computac ¸˜ ao, Unicamp Aula 15: Consistˆ encia Aula 16: Replicac ¸˜ ao

Upload: vodan

Post on 10-Feb-2019

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

MC714: Sistemas Distribuıdos

Prof. Lucas Wanner

Instituto de Computacao, Unicamp

Aula 15: ConsistenciaAula 16: Replicacao

Page 2: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Consistency & replication

Introduction (what’s it all about)Data-centric consistencyClient-centric consistencyReplica managementConsistency protocols

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 2 / 38

Page 3: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Performance and scalability

Main issueTo keep replicas consistent, we generally need to ensure that all conflicting operations are done inthe the same order everywhere

Conflicting operations

From the world of transactions:

Read–write conflict: a read operation and a write operation act concurrentlyWrite–write conflict: two concurrent write operations

IssueGuaranteeing global ordering on conflicting operations may be a costly operation, downgradingscalability Solution: weaken consistency requirements so that hopefully global synchronizationcan be avoided

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 3 / 38

Page 4: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Data-centric consistency models

Consistency model

A contract between a (distributed) data store and processes, in which the data store specifiesprecisely what the results of read and write operations are in the presence of concurrency.

EssentialA data store is a distributed collection of storages:

Distributed data store

Process Process Process

Local copy

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 4 / 38

Page 5: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Continuous Consistency

ObservationWe can actually talk a about a degree of consistency:

replicas may differ in their numerical valuereplicas may differ in their relative stalenessthere may be differences with respect to (number and order) of performed updateoperations

ConitConsistency unit⇒ specifies the data unit over which consistency is to be measured.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 5 / 38

Page 6: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Example: Conit

< 5, B> x := x + 2 [ x = 2 ]

[ y = 2 ]

[ y = 3 ]

[ x = 6 ]

< 8, A>

<12, A>

<14, A>

y := y + 2

y := y + 1

x := y * 2

Operation Result

x = 6; y = 3

Conit

Replica A

Vector clock A = (15, 5) Order deviation = 3 Numerical deviation = (1, 5)

< 5, B> x := x + 2 [ x = 2 ]

[ y = 5 ]<10, B> y := y + 5

Operation Result

x = 2; y = 5

Conit

Replica B

Vector clock B = (0, 11) Order deviation = 2 Numerical deviation = (3, 6)

Conit (contains the variables x and y )

Each replica has a vector clock: ([known] time @ A, [known] time @ B)B sends A operation [〈5,B〉: x := x +2]; A has made this operation permanent (cannot berolled back)

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 6 / 38

Page 7: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Example: Conit

< 5, B> x := x + 2 [ x = 2 ]

[ y = 2 ]

[ y = 3 ]

[ x = 6 ]

< 8, A>

<12, A>

<14, A>

y := y + 2

y := y + 1

x := y * 2

Operation Result

x = 6; y = 3

Conit

Replica A

Vector clock A = (15, 5) Order deviation = 3 Numerical deviation = (1, 5)

< 5, B> x := x + 2 [ x = 2 ]

[ y = 5 ]<10, B> y := y + 5

Operation Result

x = 2; y = 5

Conit

Replica B

Vector clock B = (0, 11) Order deviation = 2 Numerical deviation = (3, 6)

Conit (contains the variables x and y )

A has three pending operations⇒ order deviation = 3A has missed one operation from B, yielding a max diff of 5 units⇒ (1,5)

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 7 / 38

Page 8: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Sequential consistency

DefinitionThe result of any execution is the same as if the operations of all processes wereexecuted in some sequential order, and the operations of each individual process appearin this sequence in the order specified by its program.

P1: W(x)a

W(x)b

R(x)b

R(x)b R(x)a

R(x)a

P2:

P3:

P4:

(a)

P1: W(x)a

W(x)b

R(x)b

R(x)a R(x)b

R(x)a

P2:

P3:

P4:

(b)

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 8 / 38

Page 9: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Causal consistency

DefinitionWrites that are potentially causally related must be seen by all processes in the sameorder. Concurrent writes may be seen in a different order by different processes.

P1:

P1:

W(x)a

W(x)a

R(x)aP2:

P2:

P3:

P3:

P4:

P4:

W(x)b

W(x)b

R(x)a

R(x)a

R(x)a

R(x)a

R(x)b

R(x)b

R(x)b

R(x)b

(a)

(b)

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 9 / 38

Page 10: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Grouping operations

DefinitionAccesses to synchronization variables are sequentially consistent.No access to a synchronization variable is allowed to be performed until all previouswrites have completed everywhere.No data access is allowed to be performed until all previous accesses tosynchronization variables have been performed.

Basic ideaYou don’t care that reads and writes of a series of operations are immediately known toother processes. You just want the effect of the series itself to be known.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 10 / 38

Page 11: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Grouping operations

Acq(Lx) W(x)a Acq(Ly) W(y)b Rel(Lx) Rel(Ly)

Acq(Lx) R(x)a R(y) NIL

Acq(Ly) R(y)b

P1:

P2:

P3:

ObservationWeak consistency implies that we need to lock and unlock data (implicitly or not).

QuestionWhat would be a convenient way of making this consistency more or less transparent toprogrammers?

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 11 / 38

Page 12: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Client-centric consistency models

OverviewSystem modelMonotonic readsMonotonic writesRead-your-writesWrite-follows-reads

GoalShow how we can perhaps avoid systemwide consistency, by concentrating on whatspecific clients want, instead of what should be maintained by servers.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 12 / 38

Page 13: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Consistency for mobile users

ExampleConsider a distributed database to which you have access through your notebook.Assume your notebook acts as a front end to the database.

At location A you access the database doing reads and updates.At location B you continue your work, but unless you access the same server as theone at location A, you may detect inconsistencies:

your updates at A may not have yet been propagated to Byou may be reading newer entries than the ones available at Ayour updates at B may eventually conflict with those at A

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 13 / 38

Page 14: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Consistency for mobile users

NoteThe only thing you really want is that the entries you updated and/or read at A, are in Bthe way you left them in A. In that case, the database will appear to be consistent to you.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 14 / 38

Page 15: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Basic architecture

Read and write operations

Client moves to other locationand (transparently) connects toother replica

Wide-area network

Replicas need to maintainclient-centric consistency

Portable computer

Distributed and replicated database

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 15 / 38

Page 16: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Monotonic reads

DefinitionIf a process reads the value of a data item x , any successive read operation on x by thatprocess will always return that same or a more recent value.

WS( )x 1 R( )x1

WS( ; )x 1 x 2 R( )x2

L1:

L2:

WS( )x 1

WS( )x 2

R( )x1

R( )x2

L1:

L2:

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 16 / 38

Page 17: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Client-centric consistency: notation

NotationWS(xi [t ]) is the set of write operations (at Li ) that lead to version xi of x (at time t)WS(xi [t1];xj [t2]) indicates that it is known that WS(xi [t1]) is part of WS(xj [t2]).Note: Parameter t is omitted from figures.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 17 / 38

Page 18: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Monotonic reads

ExampleAutomatically reading your personal calendar updates from different servers. MonotonicReads guarantees that the user sees all updates, no matter from which server theautomatic reading takes place.

ExampleReading (not modifying) incoming mail while you are on the move. Each time you connectto a different e-mail server, that server fetches (at least) all the updates from the serveryou previously visited.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 18 / 38

Page 19: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Monotonic writes

DefinitionA write operation by a process on a data item x is completed before any successive writeoperation on x by the same process.

L1:

L2: x2

W( )x1

W( )

x2

W( )x1

W( )

L1:

L2:

WS( )x 1

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 19 / 38

Page 20: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Monotonic writes

ExampleUpdating a program at server S2, and ensuring that all components on which compilationand linking depends, are also placed at S2.

ExampleMaintaining versions of replicated files in the correct order everywhere (propagate theprevious version to the server where the newest version is installed).

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 20 / 38

Page 21: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Read your writes

DefinitionThe effect of a write operation by a process on data item x , will always be seen by asuccessive read operation on x by the same process.

L1:

L2:

W( )x1

W( )x1L1:

L2:

WS( ; )x 1 x 2 R( )x2

R( )x2WS( )x 2

ExampleUpdating your Web page andguaranteeing that your Webbrowser shows the newest versioninstead of its cached copy.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 21 / 38

Page 22: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Writes follow reads

DefinitionA write operation by a process on a data item x following a previous read operation on xby the same process, is guaranteed to take place on the same or a more recent value of xthat was read.

WS( )x 1 R( )x1

WS( ; )x 1 x 2

L1:

L2:

WS( )x 1

WS( )x 2

R( )x1L1:

L2:

W( )x2

W( )x3

ExampleSee reactions to posted articlesonly if you have the original posting(a read “pulls in” the correspondingwrite operation).

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 22 / 38

Page 23: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Distribution protocols

Replica server placementContent replication and placementContent distribution

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 23 / 38

Page 24: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Replica placement

EssenceFigure out what the best K places are out of N possible locations.

For the algorithmically inclined: facility location problem (NP-hard)Heuristic solutions

24 / 38

Page 25: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Content replication

Distinguish different processesA process is capable of hosting a replica of an object or data:

Permanent replicas: Process/machine always having a replicaServer-initiated replica: Process that can dynamically host a replica on request ofanother server in the data storeClient-initiated replica: Process that can dynamically host a replica on request of aclient (client cache)

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 25 / 38

Page 26: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Content replication

Permanentreplicas

Server-initiated replicas

Client-initiated replicas

Clients

Client-initiated replicationServer-initiated replication

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 26 / 38

Page 27: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Server-initiated replicas

Server withoutcopy of file F

Client Server withcopy of F

PQ

C1

C2

Server Q counts access from C andC as if they would come from P

12

File F

Keep track of access counts per file, aggregated by considering server closest torequesting clientsNumber of accesses drops below threshold D ⇒ drop fileNumber of accesses exceeds threshold R ⇒ replicate fileNumber of access between D and R ⇒ migrate file

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 27 / 38

Page 28: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Content distribution

ModelConsider only a client-server combination:

Propagate only notification/invalidation of update (often used for caches)Transfer data from one copy to another (distributed databases): passive replicationPropagate the update operation to other copies: active replication

NoteNo single approach is the best, but depends highly on available bandwidth andread-to-write ratio at replicas.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 28 / 38

Page 29: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Content distribution: client/server system

Pushing updates: server-initiated approach, in which update is propagatedregardless whether target asked for it.Pulling updates: client-initiated approach, in which client requests to be updated.

Issue Push-based Pull-basedState at server: List of client caches NoneMessages to be exchanged: Update (and possibly fetch update) Poll and updateResponse time at the client: Immediate (or fetch-update time) Fetch-update time

ObservationWe can dynamically switch between pulling and pushing using leases: A contract in whichthe server promises to push updates to the client until the lease expires.

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 29 / 38

Page 30: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Content distribution

IssueMake lease expiration time dependent on system’s behavior (adaptive leases):

Age-based leases: An object that hasn’t changed for a long time, will not change in the nearfuture, so provide a long-lasting leaseRenewal-frequency based leases: The more often a client requests a specific object, thelonger the expiration time for that client (for that object) will beState-based leases: The more loaded a server is, the shorter the expiration times become

QuestionWhy are we doing all this?

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 30 / 38

Page 31: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Consistency protocols

Consistency protocolDescribes the implementation of a specific consistency model.

Continuous consistencyPrimary-based protocolsReplicated-write protocols

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 31 / 38

Page 32: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Continuous consistency: Numerical errors

Principal operationEvery server Si has a log, denoted as log(Si).Consider a data item x and let weight(W ) denote the numerical change in its valueafter a write operation W . Assume that

∀W : weight(W )> 0

W is initially forwarded to one of the N replicas, denoted as origin(W ). TW [i , j] arethe writes executed by server Si that originated from Sj :

TW [i , j] = ∑{weight(W )|origin(W ) = Sj & W ∈ log(Si)}

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 32 / 38

Page 33: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Continuous consistency: Numerical errors

NoteActual value v(t) of x :

v(t) = vinit +N

∑k=1

TW [k ,k ]

value vi of x at replica i :vi = vinit +

N

∑k=1

TW [i ,k ]

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 33 / 38

Page 34: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Continuous consistency: Numerical errors

ProblemWe need to ensure that v(t)−vi < δi for every server Si .

ApproachLet every server Sk maintain a view TWk [i , j] of what it believes is the value of TW [i , j].This information can be gossiped when an update is propagated.

Note

0≤ TWk [i , j]≤ TW [i , j]≤ TW [j , j]

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 34 / 38

Page 35: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Continuous consistency: Numerical errors

SolutionSk sends operations from its log to Si when it sees that TWk [i ,k ] is getting too far fromTW [k ,k ], in particular, when

TW [k ,k ]−TWk [i ,k ]> δi/(N−1)

QuestionTo what extent are we being pessimistic here: where does δi/(N−1) come from?

NoteStaleness can be done analogously, by essentially keeping track of what has been seenlast from Si (see book).

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 35 / 38

Page 36: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Primary-based protocols

Primary-backup protocol

Data store

Primary serverfor item x

Client Client

Backup server

W1. Write requestW2. Forward request to primaryW3. Tell backups to updateW4. Acknowledge updateW5. Acknowledge write completed

W1

W2

W3 W3

W3

W4 W4

W4

W5

R1. Read requestR2. Response to read

R1 R2

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 36 / 38

Page 37: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Primary-based protocols

Primary-backup protocol with local writes

Data store

Old primaryfor item x

Client Client

Backup server

W1. Write requestW2. Move item x to new primary

W4. Tell backups to updateW5. Acknowledge update

W3. Acknowledge write completed

R1

W2

W4W4

W4

R2

R1. Read requestR2. Response to read

W1 W3

New primaryfor item x

W5 W5

W5

Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 37 / 38

Page 38: MC714: Sistemas Distribuídos - ic.unicamp.brlucas/teaching/mc714/2016-2/slides/15... · MC714: Sistemas Distribu´ıdos Prof. Lucas Wanner Instituto de Computac¸ao, Unicamp˜

Exercıcios

1 Explique porque muitos sistemas distribuıdos fazem uso de consistencia fraca.2 Explique como e feita replicacao no DNS, e porque esta replicacao funciona bem

para melhorar desempenho.3 Na Figura 7.2, o que deveria ser feito para finalizar as escritas de forma que as

replicas A e B terminem com os mesmos valores?4 Qual tipo de consistencia voce usaria para implementar um mercado online de

acoes?5 Descreva um exemplo para consistencia do tipo read-your-writes.6 O multicast totalmente ordenado com relogios de Lamport apresenta algum

problema de escalabilidade? Por que?7 Para consistencia contınua, nos assumimos que cada escrita sempre aumenta o

valor de um item de dados x. Mostre uma solucao na qual tambem e possıveldiminuir o valor de x.

38 / 38