290 likes | 397 Views
c onsistency without borders. Peter Alvaro , Peter Bailis , Neil Conway, Joseph M. Hellerstein UC Berkeley. The transaction concept. DEBIT_CREDIT: BEGIN_TRANSACTION; GET MESSAGE; EXTRACT ACCOUT_NUMBER, DELTA, TELLER, BRANCH
E N D
consistency without borders Peter Alvaro, Peter Bailis, Neil Conway, Joseph M. Hellerstein UC Berkeley
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;
An application-level contract Transactions Application Write Read Opaque store
Pervasive distribution asynchrony CAP partial failure
Research on consistency (translation) Assert: balance > 0 Application causal? PRAM? delta? fork/join? red/blue? release? SC? Consistency models Write Read Opaque store R1(X=1) R2(X=1) W1(X=2) W2(X=0) W1(X=1) W1(Y=2) R2(Y=2) R2(X=0)
Meanwhile, in industry… (prayer) Assert: balance > 0 Custom solutions Application Write Read Opaque store
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
Problem: deadlock detection Task: Identify strongly-connected components Waits-for graph
Problem: garbage collection Task: Identify nodes not reachable from Root. Root Refers-to graph
Correctness Deadlock detection • Safety:No false positives- • Liveness:Identify all deadlocks Garbage collection • Safety:Never GC live memory! • Liveness: GC all orphaned memory Root Partition
Consistency at the extremes Custom solutions? Efficient Correct Linearizable key-value store?
Object-level consistency Capture semanticsof data structures that • allow greater concurrency • maintain guarantees (e.g. convergence)
Object-level consistency Reordering Batching Retry/duplication Commutativity Associativity Idempotence Tolerant to Insert Read Read Insert Convergent data structure (e.g., Set CRDT)
Object-level consistency GC Assert: No live nodes are reclaimed Application ? ? Convergent data structures Assert: Graph replicas converge
Flow-level consistency Capture semantics of datain motion • Asynchronous dataflow model • component properties system-wide guarantees
Flow-level consistency Order-insensitivity (confluence) output set = f(input set) { } = { }
Flow-level consistency Confluence is compositional output set = f g(input set)
Graph queries as dataflow Confluent Coordinate here
Language-level consistency DSLs for distributed programming? • Capture consistency concerns in the type system
Language-level consistency CALM Theorem: Monotonic confluent Conservative, syntactic test for confluence
Language-level consistency Deadlock detector Garbage collector nonmonotonic
Where we’ve been;where we’re headed correct reusable efficient intuitive
Remember • Consistency is an application-level property • Correctness and performance are compatible • Meet programmers on their home turf • Build bridges!