Consistency in distributed systems Distributed systems Lecture # 10 Distributed systems Lecture # 10.

Slides:



Advertisements
Similar presentations
Two phase commit. Failures in a distributed system Consistency requires agreement among multiple servers –Is transaction X committed? –Have all servers.
Advertisements

Accessing data Transactions. Agenda Questions from last class? Transactions concurrency Locking rollback.
IDA / ADIT Lecture 10: Database recovery Jose M. Peña
Topic 6.3: Transactions and Concurrency Control Hari Uday.
Fakultas Ilmu Komputer UI 1 Exercise A series of actions to be taken on the database such that either all actions are completed successfully, or none of.
CS542: Topics in Distributed Systems Distributed Transactions and Two Phase Commit Protocol.
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.
Exercises for Chapter 17: Distributed Transactions
CIS 720 Concurrency Control. Timestamp-based concurrency control Assign a timestamp ts(T) to each transaction T. Each data item x has two timestamps:
1 TRANSACTION & CONCURRENCY CONTROL Huỳnh Văn Quốc Phương Thái Thị Thu Thủy
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
© City University London, Dept. of Computing Distributed Systems / Distributed Systems Session 9: Transactions Christos Kloukinas Dept. of Computing.
Transaction Processing Lecture ACID 2 phase commit.
OCT Distributed Transaction1 Lecture 13: Distributed Transactions Notes adapted from Tanenbaum’s “Distributed Systems Principles and Paradigms”
Distributed Systems 2006 Styles of Client/Server Computing.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
Persistent State Service 1 Distributed Object Transactions  Transaction principles  Concurrency control  The two-phase commit protocol  Services for.
Chapter 8 : Transaction Management. u Function and importance of transactions. u Properties of transactions. u Concurrency Control – Meaning of serializability.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 11: Transactions Dr. Michael R. Lyu Computer Science & Engineering.
Failure and Availibility DS Lecture # 12. Optimistic Replication Let everyone make changes –Only 3 % transactions ever abort Make changes, send updates.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 18: Replication Control All slides © IG.
Distributed Systems Fall 2009 Distributed transactions.
TRANSACTION PROCESSING TECHNIQUES BY SON NGUYEN VIJAY RAO.
Transactions and concurrency control
Transactions and Recovery
TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari.
INTRODUCTION TO TRANSACTION PROCESSING CHAPTER 21 (6/E) CHAPTER 17 (5/E)
Distributed Commit Dr. Yingwu Zhu. Failures in a distributed system Consistency requires agreement among multiple servers – Is transaction X committed?
CS162 Section Lecture 10 Slides based from Lecture and
© jGuru.com EJB Transactions. Transactions Simple Transaction –Transaction = more than one statement which must all succeed (or all fail) together.
Distributed Transactions March 15, Transactions What is a Distributed Transaction?  A transaction that involves more than one server  Network.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Transaction Communications Yi Sun. Outline Transaction ACID Property Distributed transaction Two phase commit protocol Nested transaction.
Lecture 12: Distributed transactions Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
Distributed Transactions
CSE 486/586 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
PAVANI REDDY KATHURI TRANSACTION COMMUNICATION. OUTLINE 0 P ART I : I NTRODUCTION 0 P ART II : C URRENT R ESEARCH 0 P ART III : F UTURE P OTENTIAL 0 R.
Transactions and Concurrency Control Distribuerade Informationssystem, 1DT060, HT 2013 Adapted from, Copyright, Frederik Hermans.
Lecture 11 – Distributed Concurrency Management Tuesday Oct 5 th, Distributed Systems.
Concurrency Control. Objectives Management of Databases Concurrency Control Database Recovery Database Security Database Administration.
 Distributed file systems having transaction facility need to support distributed transaction service.  A distributed transaction service is an extension.
Lecture 13 Advanced Transaction Models. 2 Protocols considered so far are suitable for types of transactions that arise in traditional business applications,
Distributed Transactions Chapter – Vidya Satyanarayanan.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
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.
Jennifer Widom Transactions Properties. Jennifer Widom Transactions Solution for both concurrency and failures A transaction is a sequence of one or more.
IM NTU Distributed Information Systems 2004 Distributed Transactions -- 1 Distributed Transactions Yih-Kuen Tsay Dept. of Information Management National.
Software System Lab. Transactions Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various.
A client transaction becomes distributed if it invokes operations in several different Servers There are two different ways that distributed transactions.
Lecture 8 Transactions & Concurrency UFCE8K-15-M: Data Management.
Advanced Database CS-426 Week 6 – Transaction. Transactions and Recovery Transactions A transaction is an action, or a series of actions, carried out.
Distributed Transactions What is a transaction? (A sequence of server operations that must be carried out atomically ) ACID properties - what are these.
Atomic Tranactions. Sunmeet Sethi. Index  Meaning of Atomic transaction.  Transaction model Types of storage. Transaction primitives. Properties of.
Introduction Many distributed systems require that participants agree on something On changes to important data On the status of a computation On what.
Recovery in Distributed Systems:
Two phase commit.
Transactions Properties.
Replication and Recovery in Distributed Systems
CSE 486/586 Distributed Systems Concurrency Control --- 3
Database Security Transactions
Distributed Transactions
Lecture 21: Replication Control
Exercises for Chapter 14: Distributed Transactions
UNIVERSITAS GUNADARMA
Lecture 21: Replication Control
Concurrency Control.
CIS 720 Concurrency Control.
CSE 486/586 Distributed Systems Concurrency Control --- 3
Transaction Communication
Presentation transcript:

Consistency in distributed systems Distributed systems Lecture # 10 Distributed systems Lecture # 10

Overview  Transactions  ACID  Concurrency  Locking  Timestamping  Optimistic concurrency control  Transactions  ACID  Concurrency  Locking  Timestamping  Optimistic concurrency control

transactions  Distributed systems is essentially about understanding when to use and when not to use transactions  Examples of transaction-based systems  Banking systems  Airline Ticketing systems  system?  Web cache coherence?  Distributed systems is essentially about understanding when to use and when not to use transactions  Examples of transaction-based systems  Banking systems  Airline Ticketing systems  system?  Web cache coherence?

ACID transactions  Problem  Update state on several distributed hosts  Conditions  Atomic  Consistent  Isolation  Durable  Problem  Update state on several distributed hosts  Conditions  Atomic  Consistent  Isolation  Durable

In simple words  Either do all x steps or don’t do anything  A transaction must not be affected by other ongoing transactions  Before and after the transaction everyone should be consistent  Your changes must remain consistent once you are done  Either do all x steps or don’t do anything  A transaction must not be affected by other ongoing transactions  Before and after the transaction everyone should be consistent  Your changes must remain consistent once you are done

Subtle issues  Transactions implicitly give you an “undo” button  Recoverable from failures  Transactions serialize operations, without compromising concurrency  As much as a function of transactional model as good software engineering  Transactions implicitly give you an “undo” button  Recoverable from failures  Transactions serialize operations, without compromising concurrency  As much as a function of transactional model as good software engineering

A Simple transaction  mybankAccount.withdraw(1000) if (mybankAccount.balance > 5000) mybankAccount.withdraw (3000) else myWifebankAccount.transfer(mybankAc count, (5000))  mybankAccount.withdraw(1000) if (mybankAccount.balance > 5000) mybankAccount.withdraw (3000) else myWifebankAccount.transfer(mybankAc count, (5000))

Distributed transaction Source Server C Server B Server A Open Transaction

Distributed transaction Source Server C Server B Server A Withdraw Money Deposit Money

Distributed transaction Source Server C Server B Server A Close Transaction

Under the hood  Requests are serialized  Changes saved in durable storage  Multiple transactions can run concurrently  Requests are serialized  Changes saved in durable storage  Multiple transactions can run concurrently

Commit protocol  Voting phase  Preparation of commitment  Everyone answers yes  Then commit  Two Phase Commit  Voting phase  Preparation of commitment  Everyone answers yes  Then commit  Two Phase Commit

2 Phase Commit ClientServer Can commit? yes Do Commit Committed

Failure model?  Any NACK, Time-out, causes Abort  Server Crash?  Client Crash?  Coordinator based model?  Coordinator crash?  Any NACK, Time-out, causes Abort  Server Crash?  Client Crash?  Coordinator based model?  Coordinator crash?

Concurrency in transactions  Nested transactions  Child transactions run in tandem  Parallel (different hosts)  Concurrent (different data)  Parent can commit even if a child aborts  However  If the parent aborts, should a child abort?  Nested transactions  Child transactions run in tandem  Parallel (different hosts)  Concurrent (different data)  Parent can commit even if a child aborts  However  If the parent aborts, should a child abort?

Nested Transactions

Deep nesting  Provisional commit  Level 3 “can” commit  Level 2 can only provisionally commit  Can end up with orphan transactions  Provisional commit  Level 3 “can” commit  Level 2 can only provisionally commit  Can end up with orphan transactions

concurrency  Lamport timestamps  Typically NTP time  Nest lecture  Optimistic concurrency control  Lamport timestamps  Typically NTP time  Nest lecture  Optimistic concurrency control