consistency without concurrency control in large, dynamic ......consistency without concurrency...

19
Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade Nova de Lisboa Mihai Leția, ENS Lyon Two things • no concurrency control • large dynamic

Upload: others

Post on 17-Aug-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control

in large, dynamic systems Marc Shapiro, INRIA & LIP6

Nuno Preguiça, Universidade Nova de LisboaMihai Leția, ENS Lyon

Two things • no concurrency control • large dynamic

Page 2: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Consistency without concurrency control

Object x, operation f(x)• propose f(x1)• eventually replay f(x2), f(x3), ...

If f || g commute: converges safely without concurrency control

Commutative Replicated Data Type (CRDT): Designed for commutative operations

2

x3

x1

x2

x f (x1)

g(x2)

f (x3)

g(x1)

g(x3)

Not same order at 1 and 2?OK if • concurrent f and g commuteAssuming causal delivery

Page 3: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

A sequence CRDTTreedoc = sequence of elements:

• insert-at-pos, delete• Commutative when concurrent• Minimise overhead• Scalable

A commutative replicated data type for cooperative editing, ICDCS 2009

Focus today:• Garbage collection • vs. scale

3

I will just skim the surface of the Treedoc designRefer to ICDCS paper for the details

Page 4: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Commutative updates

insert adds leaf ⇒ non-destructive, TIDs don’t change

4

1

1

0

Naming tree: minimal, self-adjusting: logarithmicTID: path = [0|1]*Contents: infix order

0L

0

Delete: tombstone, TIDs don't change

= I N R I AL ’ L

I

R

A

N I

Thanks to non-destructive updates, immutable TIDs: concurrent updates commuteEfficient: Data structures and TID lengths logarithmic *if balanced*Ignoring lots of details, e.g. concurrent inserts at same position (see paper)

Page 5: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Wikipedia GWB page: space overhead

5×10 revisions

kB serialised

Treedoc

wikidoc

GWB: most edited pageEdits translated into treedoc insert/deletes • Tree unbalanced, long TIDs, lots of tombstones: not logarathmic

Page 6: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Rebalance

6

I

R

A

N

L I

= L ' I N R I

I

R

A

N

L I

= L ' I N R I

In this example rebalancing is not spectacular.Imagine a deep unbalanced tree with lots of tombstones: large effect.Why rebalance: • Unbalanced tree costs time, space • Long TIDs • Tombstone overhead

Page 7: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

= L ' I N R I !!!

Rebalance

Invalidates TIDs:• Frame of reference = epoch• Requires agreement• Pervasive!

- e.g. Vector Clocks7

I R

N

L

I

= L ' I N R I

I

R

A

N

L I

= L ' I N R I

!!!

TID changed: R was ε, now 10Pervasive problem: • asynchronous updates ==> old data structures • see cleaning up Vector Clocks(Background colour indicates epoch)

Page 8: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Rebalance in large, dynamic systems

Rebalance requires consensusConsensus requires small, stable membership

• Large communities?!• Dynamic scenarios?!

Solution: two tiers• Core: rebalancing (and updates)• Nebula: updates (and rebalancing)• Migration protocol

8

Core: controls rebalancing

Page 9: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Core Nebula

Group membershipSmall, stableRebalance:• Unanimous agreement

(2-phase commit) • All core sites in same

epoch

9

Arbitrary membershipLarge, dynamicCommunicate with sites in same epoch only

Catch-up to rebalance, join core epoch

Migrate core to nebula: just leave group

Page 10: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Core Nebula

10

Arbitrary membershipLarge, dynamicCommunicate with sites in same epoch only

Catch-up to rebalance, join core epoch

Group membershipSmall, stableRebalance:• Unanimous agreement

(2-phase commit) • All core sites in same

epoch

Migrate from nebula to core: migrate to core epoch + join group

Page 11: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Catch-up protocol summary

11

Core Nebula

Send old updates

replay core's updates

Send rebalance

Replay rebalance,ignoring nebula updates.

Transform nebula updates.

Send transformed updates.Replay nebula updates

Here is the basic insight to the migration protocol• Replay core's updates: N now in same state as C before rebalance• Replay rebalance: *ignoring concurrent N updates*, has same effect as in C ==> same TIDs, same epoch• Transform buffer: now ready to be replayed in C (in different order, but that's OK since they commute)• N now in C state, can join the core or remain in nebula

Furthermore updates are idempotent (multiple catch-ups cause no harm)

Page 12: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Catch-up protocol

12

I

R

N I

I

R

A

N

L I

Core Site Nebula Site

del(1) ins(L,00)ins(',001)

del(1)

A

ins(L,00)ins(',001)

del in old epoch ins + ins in old epochrebalance starts new epoch

Page 13: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

rebalance

Catch-up protocol

13

I

R

N I

I

R

A

N

L I

Core Site Nebula Siteins(L,00)ins(',001)

A

del(1)rebalance

ins(L,00)ins(',001)

del in old epoch ins + ins in old epochrebalance starts new epoch

Page 14: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Catch-up protocol

14

I R

N

I

• •

I

R

N

L I

A

Core Site Nebula Site

del(1)rebalance

ins(L,00)ins(',001)

white = old epochpink = new epoch

Page 15: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Catch-up protocol

15

L

del(1)rebalance

del(1)rebalance

ins(L,00)ins(',001)

I

R

N I

A

I R

N

I

• •

Core Site Nebula Site

del uttered in old epoch ==> can send to S S replays del; now up to date with Coresend rebalance S replays rebalance; intervening ins move; S now in new epoch

Page 16: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Catch-up protocol

16

ins(L,000)ins(',0001)

I

L

L

I R

N

I

• •I R

N

I

• •

Core Site Nebula Site

ins(L,000)ins(',0001)

ins arguments transformed to new epoch

Core replays ins

Page 17: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Summary

CRDT:• Convergence ensured• Design for commutativity

GC cannot be ignored• Requires commitment• Pervasive issue

Large-scale commitment:• Core / Nebula• To synchronise: catch-up

+ migration

17

CRDT = non-locking synchronisation in weak memory model

Page 18: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems

Future work

More CRDTsUnderstanding CRDTs: what invariants can be

CRDTizedApproximations of CRDTsData types for consistent cloud computing

without concurrency control

18

Page 19: Consistency without concurrency control in large, dynamic ......Consistency without concurrency control in large, dynamic systems Marc Shapiro, INRIA & LIP6 Nuno Preguiça, Universidade

Consistency without concurrency control in large, dynamic systems 19