geo distributed db aynchronous updates
play

Geo-distributed DB Aynchronous updates P Available under Partition - PowerPoint PPT Presentation

AntidoteDB trois bases The developer-friendly open- source cloud database Just-Right Consistency Marc Shapiro, UPMC-LIP6 & Inria Annette Bieniusa, U. Kaiserslautern Nuno Preguia, Valter Balegas, U. Nova Lisboa Christopher Meiklejohn, U.


  1. AntidoteDB trois bases The developer-friendly open- source cloud database Just-Right Consistency Marc Shapiro, UPMC-LIP6 & Inria Annette Bieniusa, U. Kaiserslautern Nuno Preguiça, Valter Balegas, U. Nova Lisboa Christopher Meiklejohn, U. Catholique de Louvain [AntidoteDB & Just-Right Consistency] 4 Geo-distributed DB Aynchronous updates P Available under Partition + fault-tolerance Concurrency anomalies + low latency read Updates? Eventual Consistency: hell for developers! [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 5 6

  2. FMK Fælles Medicinkort Synchronous updates Byrum Dr Byrum Patient Alice pharma Bob Google Spanner R Dr Alice X Aalborg Hospital create (…) P Patient: Mr Bob add-med (…) Pharmacy: Byrum Consistent under Partition get-med (…) Causatin: 2 boxes ⟶ 1 Causatin: 2 boxes ⟶ 1 Conservative: one at a time process (…) Simple programming model Transactol: 1 box Expensive infrastructure Not available under partition [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 7 8 FMK invariants Geo-distrib: invariants? Byrum Byrum Dr Byrum Dr Byrum Patient Patient pharma pharma Alice Alice Bob Bob relative relative 2 2 order order all or nothing all or nothing R R Dr Alice Dr Alice X X Aalborg Hospital Aalborg Hospital 1 create (…) 1 create (…) Patient: Mr Bob Patient: Mr Bob add-med (…) add-med (…) Pharmacy: Byrum Pharmacy: Byrum EC does not maintain! get-med (…) get-med (…) Causatin: 2 boxes ⟶ 1 Causatin: 2 boxes ⟶ 1 Causatin: 2 boxes ⟶ 1 Causatin: 2 boxes ⟶ 1 CP is overkill! pre- pre- process (…) process (…) Transactol: 1 box Transactol: 1 box condition condition [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 9 10

  3. The developer-friendly Data model: registers? open-source alternative cnt ≔ 1 add-med(1) cnt ≔ 2 cnt = 0 cnt = 2 .org cnt = 0 cnt = 1 cnt ≔ 1 cnt ≔ 2 add-med(2) Preserve sequential data invariant patterns Transactional Causal Consistency (TCC) Concurrent, asynchronous updates • Maintains AP-compatible invariants • Standard register model: assignments ⟹ CP • Strongest form of consistency that is AP • AP ⟹ concurrent updates merged CAP-sensitive: Synchronise only when CRDT: register, counter, set, map, sequence strictly necessary for application ⟹ tools • Extends sequential type No specialised infrastructure, no lock-in • Encapsulates convergent merge [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 11 12 AP data model: CRDTs CRDT API cnt += 1 add-med(1) cnt += 2 .org cnt = 0 cnt = 3 cnt = 0 cnt = 3 cnt += 1 cnt += 2 add-med(2) CRDT: register, counter, set, map, sequence • Extends sequential type Concurrent, asynchronous updates • Encapsulates convergent merge • Standard register model: assignments ⟹ CP • AP ⟹ concurrent updates merged antidote: update_objects ([{ { meds , antidote_crdt_set , bucket}, CRDT: register, counter, set, map, sequence • Extends sequential type add , { "Causatin" , client1} • Encapsulates convergent merge }], TxId1). [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 13 14

  4. Relative order: Joint update: AP-Compatible AP-Compatible 1=RHS! p h a Atomic r m a ! P P update p create-p before add-pp a t i e n Relative-order invariant pattern: t ! create-p updates doctor, patient & patient! • “Patient record points to valid pharmacy record pharma! prescription” Transmit joint updates together ‣ x valid ∧ x points to y ⟹ y valid • write-atomic p >1 • admin-login-enabled ⟹ non- h + Read from common set of txns a pharma? default-password r • snapshot property m 2=LHS! a • Make RHS true; then LHS true patient? patient? = All-or-Nothing (A of ACID) ? Transmit in the right order! AP-compatible Snapshot AP-compatible: Causal Consistency [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 15 16 Transaction API Txnl Causal Consistency .org {ok, T1} = antidote: start_transaction (ignore, []). … antidote:update_objects ([{ Transactional Causal Consistency (TCC) = {meds, antidote_crdt_set, bucket}, strongest AP model add, {"Causatin", client1} Guarantees AP-compatible invariant patterns }], T1). … Antidote: first industrial-strength TCC database antidote: commit_transaction (T1). • alpha Guarantees Relative-Order and Joint-Update invariant patterns [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 17 18

  5. CAP-sensitive invariants CAP-sensitive invariants pp(…, 1) pp(…, 1) cnt –= 1 cnt –= 1 cnt ≥ 1 cnt ≥ 1 1 4 1 2 2 cnt += 3 cnt ≥ 0 cnt ≥ 0 cnt ≥ 0 cnt ≥ 0 4 2 1 2 1 cnt += 3 cnt ≥ 0 cnt ≥ 0 cnt ≥ 0 cnt ≥ 0 cnt –= 1 –= 1 2 2 cnt ≥ 0 cnt ≥ 0 add-med (…, 3) process-p (…, nb) { process-p (…, nb) { if cnt ≥ nb // precondition at source if cnt ≥ nb // precondition at source cnt –= nb // at every replica cnt –= nb // at every replica } // ≥ 0 } // cnt ≥ 0 Precondition stable w.r.t. concurrent add-med Concurrency OK [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 19 20 CAP-sensitive invariants CAP-sensitive invariants pp(…, 1) pp(…, 1) cnt –= 1 cnt –= 1 cnt ≥ 1 cnt ≥ 1 1 –1 1 2 2 cnt –= 2 cnt ≥ 0 cnt ≥ 0 cnt ≥ 0 cnt ≥ 0 –1 1 1 2 2 cnt –= 2 cnt ≥ 0 cnt ≥ 0 cnt ≥ 0 cnt ≥ 0 cnt –= 1 cnt –= 1 2 2 cnt ≥ 0 cnt ≥ 0 pp(…, 2) cnt ≥ 1 CISE Static process-p (…, nb) { process-p (…, nb) { Analysis if cnt ≥ nb // precondition at source if cnt ≥ nb // precondition at source cnt –= nb // at every replica cnt –= nb // at every replica } // cnt ≥ 0 } // cnt ≥ 0 Precondition not stable w.r.t. concurrent process-p • Forbid concurrency? Synchro, CP. • Or remove invariant? AP, degraded semantics [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 21 22

  6. Bounded Counter CISE tools Specific but common case Static analysis of any application: Shared counter: • Operations, invariants • x ≥ 0 • Does each individual op maintain invariant? • increment (n) • Do concurrent updates converge? • decrement (n) // precondition x ≥ n • Is precondition of u stable w.r.t. concurrent v ? Escrow: AP If not: • Local share, decrement share –= n ‣ Change specification (invariant) CP • Synchronise only when share < n ‣ or Synchronise • Donate share AP ‣ Designer decision, per pair (u, v) Encapsulated, proven correct (CISE) Ex: medication count= inc || inc , inc || dec , dec || dec Mostly AP [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 23 24 Just-Right Consistency AntidoteDB .org Methodology for provably ensuring As Available as Possible, Consistent Enough Rich interface with concurrent abstract data types (CRDTs) TCC ⟹ AP-compatible invariants Geo-replication CAP-sensitive invariants: Bounded Ctr, CISE Low latency, Availiable under Partition ⟹ AP- CP when Erlang / Riak Core compatible necessary AntidoteDB: New, growing community • CRDTs Active development CISE verification • Causal Consistency • Secondary Indexes, configurable back-ends & co-design • Transactions and protocols, partial replication, clients in • Bounded Counter (+ related tools) many languages, SQL interface, etc. mostly AP [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 25 26

  7. Get started with .org info@antidotedb.com Creative Commons Attribution-ShareAlike 4.0 Intl. License You are free to: • Share — copy and redistribute the material in any medium or format • Adapt — remix, transform, and build upon the material for any purpose, even commercially, under the following terms: Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. [AntidoteDB & Just-Right Consistency] [AntidoteDB & Just-Right Consistency] 27 28

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend