Eventually Consistent

19
Eventually Consistent [email protected] woensdag 21 juli 2010

description

Summary of Werner Vogels' paper on eventual consistency.

Transcript of Eventually Consistent

Page 1: Eventually Consistent

Eventually Consistent

[email protected]

woensdag 21 juli 2010

Page 2: Eventually Consistent

Werner Vogels

woensdag 21 juli 2010

Page 3: Eventually Consistent

‘60sDistribution

Transparency

‘90sMinimize

Failure

woensdag 21 juli 2010

Page 4: Eventually Consistent

Client Perspective

woensdag 21 juli 2010

Page 5: Eventually Consistent

AB

C

Model

woensdag 21 juli 2010

Page 6: Eventually Consistent

Strong Consistency

AB

C

1

2

2

2

0 value = "foo"

value = "bar"

value = "bar" value = "bar"

value = "bar"

After the update, any subsequent access will return the updated value.

woensdag 21 juli 2010

Page 7: Eventually Consistent

Weak Consistency

AB

C

1 value = "bar"

value = "bar" /"foo"

value = "bar" / "foo"

value = "bar" / "foo"

0 value = "foo"

>1

>1

>1

The system does not guarantee that at any given point in the future subsequent access will return the updated value

woensdag 21 juli 2010

Page 8: Eventually Consistent

Eventual Consistency

If no updates are made to the object, eventually all accesses will return the last updated value.

AB

C

1 value = "bar"

value = "bar" value = "bar"

value = "bar"

0 value = "foo"

t

t

t

t ≥ 1

woensdag 21 juli 2010

Page 9: Eventually Consistent

Causal Consistency

Subsequent access by process B will return the updated value, and a write is guaranteed to supersede the earlier write.

AB

C

1 value = "bar"

value = "foo"

value = "bar"

0 value = "foo"

3

3

2 notification of update

woensdag 21 juli 2010

Page 10: Eventually Consistent

Read-your-writes Consistency

Process A, after updating a data item always access the updated value and never sees an older value

AB

C

1 value = "bar"

0 value = "foo"

2 value = "bar"

woensdag 21 juli 2010

Page 11: Eventually Consistent

Session Consistency

Within the “session”, the system guarantees read-your-writes consistency

2 value = "foo"

Session 1

Session 2

AB

C

1 value = "bar"

0 value = "foo"

2 value = "bar"

woensdag 21 juli 2010

Page 12: Eventually Consistent

Monotonic Read Consistency

If a process has seen a particular value for the object, any subsequent access will never return any previous values

AB

C

0 value = "foo"

1 value = "foo"

2 value = "foo"

4 value = "bar"

3

value = "bar"

woensdag 21 juli 2010

Page 13: Eventually Consistent

Monotonic Write Consistency

The system guarantees to serialize the writes by the same process

AB

C

0 value = "foo"

1value = "bar"

2value = "last"

woensdag 21 juli 2010

Page 14: Eventually Consistent

Eventual Consistentency in RDBMS

Eventual consistency is not just a property of NoSQL Solutions

APrimary Backup replica

async

Log shipping

1

2

3

woensdag 21 juli 2010

Page 15: Eventually Consistent

Server Perspective

woensdag 21 juli 2010

Page 16: Eventually Consistent

NRW

N The number of nodes that store replicates of the data

W The number of replicas that need to acknowledge the receipt of the update before the update completes

R The number of replicas that are contacted when a data object is accessed through a read operation

woensdag 21 juli 2010

Page 17: Eventually Consistent

Strong Consistency

W + R > N implies strong consistency

W = 3

N = 4R = 2

A

value = "foo"

value = "foo"

value = "foo"

value = "foo"

woensdag 21 juli 2010

Page 18: Eventually Consistent

Optimizations

• Optimize read: R = 1, N = W

• Optimize write: W = 1, N = R

woensdag 21 juli 2010

Page 19: Eventually Consistent

Design Considerations

• Clients implementing read-your-writes and monotonic reads, by adding versions on writes, and discarding everything the precedes the last-seen version.

woensdag 21 juli 2010