YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: consistency without borders

consistency without borders

Peter Alvaro, Peter Bailis, Neil Conway, Joseph M. Hellerstein UC Berkeley

Page 2: consistency without borders

The transaction concept

 DEBIT_CREDIT:                        BEGIN_TRANSACTION;                        GET  MESSAGE;                        EXTRACT  ACCOUT_NUMBER,  DELTA,  TELLER,  BRANCH                                FROM  MESSAGE;                        FIND  ACCOUNT(ACCOUT_NUMBER)  IN  DATA  BASE;                        IF  NOT_FOUND    |  ACCOUNT_BALANCE  +  DELTA  <  0  THEN                                  PUT  NEGATIVE  RESPONSE;                        ELSE  DO;                                  ACCOUNT_BALANCE  =  ACCOUNT_BALANCE  +  DELTA;                                  POST  HISTORY  RECORD  ON  ACCOUNT  (DELTA);                                  CASH_DRAWER(TELLER)  =  CASH_DRAWER(TELLER)  +  DELTA;                                  BRANCH_BALANCE(BRANCH)  =  BRANCH_BALANCE(BRANCH)  +  DELTA;                                  PUT  MESSAGE  ('NEW  BALANCE  ='  ACCOUNT_BALANCE);                                  END;                        COMMIT;    

Page 3: consistency without borders

The transaction concept

 DEBIT_CREDIT:                        BEGIN_TRANSACTION;                        GET  MESSAGE;                        EXTRACT  ACCOUT_NUMBER,  DELTA,  TELLER,  BRANCH                                FROM  MESSAGE;                        FIND  ACCOUNT(ACCOUT_NUMBER)  IN  DATA  BASE;                        IF  NOT_FOUND    |  ACCOUNT_BALANCE  +  DELTA  <  0  THEN                                  PUT  NEGATIVE  RESPONSE;                        ELSE  DO;                                  ACCOUNT_BALANCE  =  ACCOUNT_BALANCE  +  DELTA;                                  POST  HISTORY  RECORD  ON  ACCOUNT  (DELTA);                                  CASH_DRAWER(TELLER)  =  CASH_DRAWER(TELLER)  +  DELTA;                                  BRANCH_BALANCE(BRANCH)  =  BRANCH_BALANCE(BRANCH)  +  DELTA;                                  PUT  MESSAGE  ('NEW  BALANCE  ='  ACCOUNT_BALANCE);                                  END;                        COMMIT;    

Page 4: consistency without borders

An application-level contract

Write   Read  

Application

Opaque store

Transactions

Page 5: consistency without borders

Pervasive distribution

Page 6: consistency without borders

Pervasive distribution

partial failure

Page 7: consistency without borders

Pervasive distribution

partial failure

asynchrony

Page 8: consistency without borders

Pervasive distribution

CAP

partial failure

asynchrony

Page 9: consistency without borders

Research on consistency

Write   Read  

Application

Opaque store

Consistency models

R1(X=1)  R2(X=1)  W1(X=2)  W2(X=0)  W1(X=1)  W1(Y=2)  R2(Y=2)  R2(X=0)  

Page 10: consistency without borders

Research on consistency

Write   Read  

Application

Opaque store

Consistency models

Assert: balance > 0

causal? PRAM? delta? fork/join? red/blue? release? SC?

(translation)

R1(X=1)  R2(X=1)  W1(X=2)  W2(X=0)  W1(X=1)  W1(Y=2)  R2(Y=2)  R2(X=0)  

Page 11: consistency without borders

Meanwhile, in industry…

Application

Opaque store

Custom solutions

Write   Read  

Page 12: consistency without borders

Meanwhile, in industry…

Application

Opaque store

Custom solutions Assert: balance > 0

(prayer)

Write   Read  

Page 13: consistency without borders

Distributed consistency: staying relevant

•  Is this an important problem? •  Is academia disconnected from reality? •  OK, what now?

Goal: help programmers write correct applications. Today: some promising approaches

Page 14: consistency without borders

Case study: a graph

T1T2

T4

T10

T3

T6

T5

T9

T7

T8

T11

T12

T13

T14

Page 15: consistency without borders

Partitioned, for scalability

T1T2

T4

T10

T3

T6

T5

T9

T7

T8

T11

T12

T13

T14

Page 16: consistency without borders

Replicated, for availability

T1T2

T4

T10

T3

T6

T5

T9

T7

T8

T11

T12

T13

T14

T1T2

T4

T10

T3

T6

T5

T9

T7

T8

T11

T12

T13

T14

Page 17: consistency without borders

Problem: deadlock detection

Task: Identify strongly-connected components

Waits-for graph

T1T2

T4

T10

T3

T6

T5

T9

T7

T8

T11

T12

T13

T14

Page 18: consistency without borders

Problem: garbage collection

Task: Identify nodes not reachable from Root.

Root  

Refers-to graph

T1T2

T4

T10

T3

T6

T5

T9

T7

T8

T11

T12

T13

T14

Page 19: consistency without borders

T1T2

T4

T10

T3

T6

T5

T9

T7

T8

T11

T12

T13

T14

Correctness

Deadlock detection •  Safety: No false positives-

•  Liveness: Identify all deadlocks

Garbage collection •  Safety: Never GC live memory!

•  Liveness: GC all orphaned memory

T1T2

T4

T10

T3

T6

T5

T9

T7

T8

T11

T12

T13

T14

ParLLon  

Root  

Page 20: consistency without borders

Consistency at the extremes

StorageObjectFlow

LanguageApplication

Linearizable key-value store?

   Custom solutions?

Page 21: consistency without borders

Consistency at the extremes

StorageObjectFlow

LanguageApplication

Linearizable key-value store?

   Custom solutions?

Efficient Correct

Page 22: consistency without borders

Consistency across the stack

Page 23: consistency without borders

Object-level consistency

Capture semantics of data structures that •  allow greater concurrency •  maintain guarantees (e.g. convergence)

StorageObjectFlow

LanguageApplication

Page 24: consistency without borders

Insert   Read  

Convergent data structure (e.g., Set CRDT)

Object-level consistency

Insert   Read  

Commutativity Associativity Idempotence

Reordering Batching Retry/duplication

Tolerant to

Page 25: consistency without borders

Application

Convergent data structures

Object-level consistency

?   ?  

GC Assert: No live nodes are reclaimed

Assert: Graph replicas converge

Page 26: consistency without borders

Flow-level consistency  

StorageObjectFlow

LanguageApplication

Page 27: consistency without borders

Flow-level consistency  

Capture semantics of data in motion •  Asynchronous dataflow model •  component properties à system-wide guarantees

Graphstore

Transactionmanager

Transitiveclosure

Deadlockdetector

Con!uent Con!uentCon!uent

Page 28: consistency without borders

Flow-level consistency

Order-insensitivity (confluence)

output  set  =  f(input  set)      

{                }  

{                }  =  

Page 29: consistency without borders

Flow-level consistency

Confluence is compositional

output  set  =  f  �  g(input  set)      

Page 30: consistency without borders

Flow-level consistency

Confluence is compositional

output  set  =  f  �  g(input  set)      

Page 31: consistency without borders

Graphstore

Memoryallocator

Transitiveclosure

Garbagecollector

Con!uent Not

Con!uent

Con!uent

Graphstore

Transactionmanager

Transitiveclosure

Deadlockdetector

Con!uent Con!uentCon!uent

Graph queries as dataflow

Page 32: consistency without borders

Graphstore

Memoryallocator

Transitiveclosure

Garbagecollector

Con!uent Not

Con!uent

Con!uent

Graphstore

Transactionmanager

Transitiveclosure

Deadlockdetector

Con!uent Con!uentCon!uent

Graph queries as dataflow Confluent

Coordinate  here  

Page 33: consistency without borders

Language-level consistency  

DSLs for distributed programming? •  Capture consistency concerns in the

type system

   

StorageObjectFlow

LanguageApplication

Page 34: consistency without borders

Language-level consistency  

CALM Theorem:

Monotonic à confluent

Conservative, syntactic test for confluence

 

Page 35: consistency without borders

Language-level consistency

Deadlock detector

Garbage collector

Page 36: consistency without borders

Language-level consistency

Deadlock detector

Garbage collector

nonmonotonic  

Page 37: consistency without borders

StorageObjectFlow

LanguageApplication

correct reusable

efficient intuitive

Where we’ve been; where we’re headed

Page 38: consistency without borders

StorageObjectFlow

LanguageApplication

correct reusable

efficient intuitive

Where we’ve been; where we’re headed

Page 39: consistency without borders

StorageObjectFlow

LanguageApplication

correct reusable

efficient intuitive

Where we’ve been; where we’re headed

Page 40: consistency without borders

Remember

•  Consistency is an application-level property

•  Correctness and performance are compatible

•  Meet programmers on their home turf

•  Build bridges!

Page 41: consistency without borders

Queries?