Giovanni Chierico | May 2012 | Дубна Consistency in a distributed world.

Slides:



Advertisements
Similar presentations
Case Study - Amazon. Amazon r Amazon has many Data Centers r Hundreds of services r Thousands of commodity machines r Millions of customers at peak times.
Advertisements

Cassandra Structured Storage System over a P2P Network Avinash Lakshman, Prashant Malik.
COS 461 Fall 1997 Transaction Processing u normal systems lose their state when they crash u many applications need better behavior u today’s topic: how.
Consensus Algorithms Willem Visser RW334. Why do we need consensus? Distributed Databases – Need to know others committed/aborted a transaction to avoid.
1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School.
Virtual Synchrony Jared Cantwell. Review Multicast Causal and total ordering Consistent Cuts Synchronized clocks Impossibility of consensus Distributed.
CMPT Dr. Alexandra Fedorova Lecture X: Transactions.
Salt: Combining ACID and BASE in a Distributed Database
Transaction Processing Lecture ACID 2 phase commit.
CS 582 / CMPE 481 Distributed Systems
Transaction Management and Concurrency Control
Persistent State Service 1 Distributed Object Transactions  Transaction principles  Concurrency control  The two-phase commit protocol  Services for.
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
©Silberschatz, Korth and Sudarshan19.1Database System Concepts Distributed Transactions Transaction may access data at several sites. Each site has a local.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 18: Replication Control All slides © IG.
Low-Latency Multi-Datacenter Databases using Replicated Commit
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
TRANSACTION PROCESSING TECHNIQUES BY SON NGUYEN VIJAY RAO.
Distributed Databases
IBM Haifa Research 1 The Cloud Trade Off IBM Haifa Research Storage Systems.
Massively Parallel Cloud Data Storage Systems S. Sudarshan IIT Bombay.
Databases with Scalable capabilities Presented by Mike Trischetta.
Distributed Storage System Survey
Paxos Made Simple Jinghe Zhang. Introduction Lock is the easiest way to manage concurrency Mutex and semaphore. Read and write locks. In distributed system:
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
Molecular Transactions G. Ramalingam Kapil Vaswani Rigorous Software Engineering, MSRI.
Chapter 19 Recovery and Fault Tolerance Copyright © 2008.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Trade-offs in Cloud.
Megastore: Providing Scalable, Highly Available Storage for Interactive Services J. Baker, C. Bond, J.C. Corbett, JJ Furman, A. Khorlin, J. Larson, J-M.
Transaction Communications Yi Sun. Outline Transaction ACID Property Distributed transaction Two phase commit protocol Nested transaction.
Distributed Transactions Chapter 13
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Data Versioning Lecturer.
Concurrency and Transaction Processing. Concurrency models 1. Pessimistic –avoids conflicts by acquiring locks on data that is being read, so no other.
Chapter 15 Recovery. Topics in this Chapter Transactions Transaction Recovery System Recovery Media Recovery Two-Phase Commit SQL Facilities.
1 Transactions Chapter Transactions A transaction is: a logical unit of work a sequence of steps to accomplish a single task Can have multiple.
Replicated Databases. Reading Textbook: Ch.13 Textbook: Ch.13 FarkasCSCE Spring
The Relational Model1 Transaction Processing Units of Work.
Commit Algorithms Hamid Al-Hamadi CS 5204 November 17, 2009.
CAP Theorem Justin DeBrabant CIS Advanced Systems - Fall 2013.
Giovanni Chierico | May 2012 | Дубна Data Concurrency, Consistency and Integrity.
Two-Phase Commit Brad Karp UCL Computer Science CS GZ03 / M th October, 2008.
Transactions. Transaction: Informal Definition A transaction is a piece of code that accesses a shared database such that each transaction accesses shared.
CSC 240 (Blum)1 Database Transactions. CSC 240 (Blum)2 Transaction  A transaction is an interaction between a user (or application) and a database. A.
Section 06 (a)RDBMS (a) Supplement RDBMS Issues 2 HSQ - DATABASES & SQL And Franchise Colleges By MANSHA NAWAZ.
NoSQL Or Peles. What is NoSQL A collection of various technologies meant to work around RDBMS limitations (mostly performance) Not much of a definition...
1 Intro stored procedures Declaring parameters Using in a sproc Intro to transactions Concurrency control & recovery States of transactions Desirable.
BASE Dan Pritchett, Ebay ACM Queue, May/June 2008.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
Robustness in the Salus scalable block store Yang Wang, Manos Kapritsos, Zuocheng Ren, Prince Mahajan, Jeevitha Kirubanandam, Lorenzo Alvisi, and Mike.
Group Communication A group is a collection of users sharing some common interest.Group-based activities are steadily increasing. There are many types.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
CS 540 Database Management Systems NoSQL & NewSQL Some slides due to Magda Balazinska 1.
Distributed Databases – Advanced Concepts Chapter 25 in Textbook.
CSCI5570 Large Scale Data Processing Systems
Trade-offs in Cloud Databases
Distributed Systems – Paxos
CPS 512 midterm exam #1, 10/7/2016 Your name please: ___________________ NetID:___________ /60 /40 /10.
Introduction to NewSQL
Transactions Properties.
NoSQL Databases An Overview
Implementing Consistency -- Paxos
EECS 498 Introduction to Distributed Systems Fall 2017
Commit Protocols CS60002: Distributed Systems
CS 440 Database Management Systems
Lecture 21: Replication Control
Atomic Commit and Concurrency Control
EECS 498 Introduction to Distributed Systems Fall 2017
Lecture 21: Replication Control
Implementing Consistency -- Paxos
Presentation transcript:

Giovanni Chierico | May 2012 | Дубна Consistency in a distributed world

Giovanni Chierico | May 2012 | Дубна My goals Quick Review Distributed Transactions A Different Approach CAP Theorem Eventually Consistent Best Practices 2

Giovanni Chierico | May 2012 | Дубна Quick Review 3 The Good Concurrency Consistency Integrity The Bad Locks The really ugly Failures large scale systems?

Giovanni Chierico | May 2012 | Дубна Distributed System 4 Still the same problems Concurrency Consistency Integrity But more things that can fail

Giovanni Chierico | May 2012 | Дубна Two Generals’ Problem 5 G1G2 E Rules 1.Single General attack ⇒ Defeat 2.Double attack ⇒ Victory 3.Unreliable communication 1.G1: Let’s attack at 18:45 2.G2: confirmation 3.G1: confirmation 4.…

Giovanni Chierico | May 2012 | Дубна Two-Phase Commit (2PC) 6 Goal: all commit or all rollback 1.Prepare Phase Initiator asks other nodes to promise to commit or rollback, even if there’s a failure If any node cannot prepare ⇒ rollback 2.Commit Phase Initiator commits and asks others to do the same

Giovanni Chierico | May 2012 | Дубна Two-Phase Commit (2PC) 7 Prepare Phase: promise to commit or roll-back 1.Record operation in the “REDO” logs so that it can either commit or rollback regardless of failures 2.Place a “read lock” on the modified tables 3.Flag the transaction as “in-doubt” Non-failure case 1.Coordinator will ask to either commit or rollback 2.Remove the locks Failure Transaction will remain “in-doubt” and resources are inaccessible

Giovanni Chierico | May 2012 | Дубна Two-Phase Commit (2PC) Pros ACID Transparent (abstraction doesn’t “leak”) Cons When it works Expensive Read Locks When it fails Leaves Locks 8 “Better” Solutions Exist More Complex More expensive Consensus (Paxos) Google’s “Chubby”

Giovanni Chierico | May 2012 | Дубна A Different Approach 9 Your Coffee Shop Doesn’t Use Two-Phase Commit Employees: Baristas (B) and Cashiers (C) Process 1.You order to C 2.C writes your name on cup and puts it in a queue 3.You pay to C 4.B eventually prepares coffee and calls your name 5.You pick up your coffee Asynchronous Pros: less locking ⇒ more efficient use of resources Cons: A whole set of different problems …

Giovanni Chierico | May 2012 | Дубна Asynchronous Problems 10 Correlation: orders might be fulfilled not in the order they are queued ⇒ correlation identifier Exception Handling: cannot be easily “abstracted” Write-off: coffee made but you can’t pay Retry: coffee was not good (idempotent receivers) Compensating action: coffee machines breaks Optimistic “Happy Day” Approach Pessimistic Approach: Escrow Company Prepare: debit money Rollback: credit money back Commit: do nothing

Giovanni Chierico | May 2012 | Дубна Compensating Action Not as “simple” as in the ACID world Some things cannot be compensated for Shifts burden From infrastructure (declarative) To the client (ad-hoc solutions) Less “economy of scale” Monitoring, Control,... 11

Giovanni Chierico | May 2012 | Дубна Conversation Pattern 12 Async Sync Half-sync Half-async Half-sync Half-async

Giovanni Chierico | May 2012 | Дубна CAP Theorem Consistency Availability Partition-tolerance All 3 are desirable Can have any 2 but not 3 ACID Vs BASE Basically Available, Soft State, Eventually Consistent 13 Distributed Transactions

Giovanni Chierico | May 2012 | Дубна Eventually Consistent 14 Partitions are a given in larger systems Relax availability Might refuse to write Relax consistency Accept a write but this is not reflected in subsequent reads Strong: after update any read will get the updated value Weak: inconsistency window Eventual: if not further updates all the read will “eventually” get the update value. Inconsistency Window = f(delays, load, #replicas, …)

Giovanni Chierico | May 2012 | Дубна Eventually Consistent Causal C: A updates, tells B, B reads updated value Read-yours-writes C special case of previous Session Consistency C as long the session exists RYWC is guaranteed Monotonic Read C Once you see a value you never see a previous version Monotonic Write C Serialise Writes Amazon’s Dynamo “has brought all of these properties under explicit control of the application architecture”, “allow the application service owner […] to make the trade-offs between consistency, durability, availability, and performance at a certain cost point" 15

Giovanni Chierico | May 2012 | Дубна Scalability Best Practices Avoid Distributed Transactions “we allow absolutely no client-side or distributed transactions of any kind - no two-phase commit.” Decouple Functions Asynchronously Messages and queues Move Processing To Asynchronous Flows Execution latency Vs User latency Scale for peak Vs Scale for average 16 EBay

Giovanni Chierico | May 2012 | Дубна Lesson Learned Large distributed systems often have different needs and requirements To maximise “business value” we might need to relax some constraints Problems are often “wicked” and the best solution depends on a lot of details and dependencies 17

Giovanni Chierico | May 2012 | Дубна Q&A 18

Giovanni Chierico | May 2012 | Дубна спасибо Globe of Science and Innovation, CERN 19

Giovanni Chierico | May 2012 | Дубна 20