Eventually Consistent

Preview:

DESCRIPTION

Summary of Werner Vogels' paper on eventual consistency.

Citation preview

Eventually Consistent

wspringer@xebia.com

woensdag 21 juli 2010

Werner Vogels

woensdag 21 juli 2010

‘60sDistribution

Transparency

‘90sMinimize

Failure

woensdag 21 juli 2010

Client Perspective

woensdag 21 juli 2010

AB

C

Model

woensdag 21 juli 2010

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

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

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

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

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

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

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

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

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

Server Perspective

woensdag 21 juli 2010

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

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

Optimizations

• Optimize read: R = 1, N = W

• Optimize write: W = 1, N = R

woensdag 21 juli 2010

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

Recommended