CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Transactions Steve Ko Computer Sciences and Engineering University at Buffalo.

Slides:



Advertisements
Similar presentations
CS 542: Topics in Distributed Systems Transactions and Concurrency Control.
Advertisements

CSE 486/586 Distributed Systems Remote Procedure Call
Failure Detection The ping-ack failure detector in a synchronous system satisfies – A: completeness – B: accuracy – C: neither – D: both.
Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Consensus Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Byzantine Fault Tolerance Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Replication Steve Ko Computer Sciences and Engineering University at Buffalo.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Lecture 8-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2012 Indranil Gupta (Indy) September 20, 2012 Lecture 8 RPCs and Distributed.
1 TRANSACTION & CONCURRENCY CONTROL Huỳnh Văn Quốc Phương Thái Thị Thu Thủy
Computer Science 425 Distributed Systems Lecture 21 Transaction Processing and Concurrency Control Reading: Sections
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Systems Fall 2010 Replication Fall 20105DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
CMPT Dr. Alexandra Fedorova Lecture X: Transactions.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 18: Replication Control All slides © IG.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed File Systems Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Mid-Semester Overview Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
CS425 /CSE424/ECE428 – Distributed Systems – Fall Nikita Borisov - UIUC1 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S.
Lecture 16-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) October 17, 2013 Lecture 16 Concurrency Control.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed Shared Memory Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Systems CS 425 / CSE 424 / ECE 428 Transactions & Concurrency Control  2010, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi,
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Replication with View Synchronous Group Communication Steve Ko Computer Sciences and Engineering.
CSE 486/586 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
Transaction processing Book, chapter 6.6. Problem: With a single user…. you run a query, you get the results, you run the next, etc. But database life.
Lecture 15-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2010 Indranil Gupta (Indy) October 12, 2010 Lecture 15 RPCs and Distributed.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Wrap-up Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Wrap-up Steve Ko Computer Sciences and Engineering University at Buffalo.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion & Leader Election Steve Ko Computer Sciences and Engineering University.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Replication Steve Ko Computer Sciences and Engineering University at Buffalo.
Lecture 8-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) September 19, 2013 Lecture 8 RPCs and Distributed.
Distributed objects and remote invocation Pages
CSE 486/586 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Byzantine Fault Tolerance Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Transactions on Replicated Data Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586 CSE 486/586 Distributed Systems Leader Election Steve Ko Computer Sciences and Engineering University at Buffalo.
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Distributed Systems Lecture 8 RPC and marshalling 1.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Systems Lecture 12 Concurrency and replication control 1.
CSE 486/586 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586 Distributed Systems Wrap-up
CSE 486/586 Distributed Systems Mid-Semester Overview
CSE 486/586 Distributed Systems Remote Procedure Call
CSE 486/586 Distributed Systems Consistency --- 1
CSE 486/586 Distributed Systems Wrap-up
CSE 486/586 Distributed Systems Concurrency Control --- 1
CSE 486/586 Distributed Systems Consistency --- 1
CSE 486/586 Distributed Systems Concurrency Control --- 2
CSE 486/586 Distributed Systems Concurrency Control --- 3
Lecture 21: Replication Control
IS 651: Distributed Systems Final Exam
CSE 486/586 Distributed Systems Concurrency Control --- 2
CSE 486/586 Distributed Systems Concurrency Control --- 1
Lecture 21: Replication Control
CSE 486/586 Distributed Systems Concurrency Control --- 3
CSE 486/586 Distributed Systems Mid-Semester Overview
Presentation transcript:

CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Transactions Steve Ko Computer Sciences and Engineering University at Buffalo

CSE 486/586, Spring 2012 Recap: RPC Process 2 Client Process Client Function Client Stub Socket API Server Process Server Function Server Stub Socket API Marshalling/unmarshalling

CSE 486/586, Spring 2012 Recap: Stub Generation 3 Interface Specification Stub Generator Server Stub Common Header Client Stub Client Source RPC LIBRARY Server Source Compiler / Linker RPC LIBRARY Client Program Server Program Compiler / Linker e.g., in SUN XDR e.g., rpcgen gcc.o,.exe.c.h gcc

CSE 486/586, Spring 2012 Recap: Port Mapper 4 Client Program Server procedure Server Stub Client Stub Network Code Port Mapper SERVER CLIENT Finding An RPC: RPCs live on specific hosts at specific ports. Port mapper on the host maps from RPC name to port# When a server process is initialized, it registers its RPCs (handle) with the port mapper on the server A client first connects to port mapper (daemon on standard port) to get this handle The call to RPC is then made by connecting to the corresponding port

CSE 486/586, Spring 2012 Recap: Failure Modes of RPC Execute Reply correct function Execute, Crash Request Crash Request Execute Reply Execute Reply crash before reply crash before execution lost request Channel fails during reply Client machine fails before receiving reply 5

CSE 486/586, Spring 2012 Recap: Invocation Semantics Local procedure call: exactly-once Remote procedure call: –0 times: server crashed or server process died before executing server code –1 time: everything worked well, as expected –1 or more: excess latency or lost reply from server and client retransmission When do these make sense? –Idempotent functions: OK to run any number of times –Non-idempotent functions: cannot do it What we can offer –At least once –At most once 6

CSE 486/586, Spring 2012 Recap: Invocation Semantics Fault tolerance measures Invocation semantics Retransmit request message Duplicate filtering Re-execute procedure or retransmit reply No Yes Not applicable No Yes Not applicable Re-execute procedure Retransmit old replyAt-most-once At-least-once Maybe 7

CSE 486/586, Spring 2012 We’re at a Mid-Point: What We’ve Discussed So Far Main communication infrastructure: the Internet Communication between two processes –Socket API –RPC Communication between multiple processes –Multicast algorithms Concept of time in distributed systems Organization of distributed systems –Server-client –Peer-to-peer, DHTs Impossibility of consensus Distributed algorithms –Failure detection, global snapshots, mutual exclusion, leader election 8

CSE 486/586, Spring 2012 The Other Half of the Semester Distributed storage Consensus algorithm: Paxos BFT (Byzantine Fault Tolerance) Security 9

CSE 486/586, Spring 2012 Today: Banking Example (Once Again) Banking transaction for a customer (e.g., at ATM or browser) –Transfer $100 from saving to checking account –Transfer $200 from money-market to checking account –Withdraw $400 from checking account Transaction 1.savings.deduct(100) 2.checking.add(100) 3.mnymkt.deduct(200) 4.checking.add(200) 5.checking.deduct(400) 6.dispense(400) 10

CSE 486/586, Spring 2012 Wait…We’ve Seen This Before… What are some things that can go wrong? –Multiple clients –Multiple servers How do you solve this? –Group everything as if it’s a single step Where have we seen this? –Mutual exclusion lecture So, we’re done? –No, we’re not satisfied. 11

CSE 486/586, Spring 2012 Why Not Satisfied? Process 1 lock(mutex); savings.deduct(100); checking.add(100); mnymkt.deduct(200); checking.add(200); checking.deduct(400); dispense(400); unlock(mutex); Process 2 lock(mutex); savings.deduct(100); checking.add(100); mnymkt.deduct(200); checking.add(200); checking.deduct(400); dispense(400); unlock(mutex); 12

CSE 486/586, Spring 2012 Why Not Satisfied? 1. savings.deduct(100) 2. checking.add(100) 3. mnymkt.deduct(200) 4. checking.add(200) 5. checking.deduct(400) 6. dispense(400) 13 A failure at these points means the customer loses money; we need to restore old state A failure at these points does not cause lost money, but old steps cannot be repeated

CSE 486/586, Spring 2012 Why Not Satisfied? What we discussed in mutual exclusion is one big lock. –Everyone else has to wait. –It does not necessarily deal with failures. Performance –Observation: we can interleave some operations from different processes. Failure –If a process crashes while holding a lock Let’s go beyond simple locking! 14

CSE 486/586, Spring 2012 Transaction Abstraction for grouping multiple operations into one A transaction is indivisible (atomic) from the point of view of other transactions –No access to intermediate results/states –Free from interference by other operations Primitives –begin(): begins a transaction –commit(): tries completing the transaction –abort(): aborts the transaction Implementing transactions –Performance: finding out what operations we can interleave –Failure: dealing with failures, rolling back changes if necessary 15

CSE 486/586, Spring 2012 Properties of Transactions: ACID Atomicity: All or nothing Consistency: if the server starts in a consistent state, the transaction ends with the server in a consistent state. Isolation: Each transaction must be performed without interference from other transactions, i.e., the non-final effects of a transaction must not be visible to other transactions. Durability: After a transaction has completed successfully, all its effects are saved in permanent storage. 16

CSE 486/586, Spring 2012 Problems to Avoid Things to watch for when interleaving operations Lost update –One transaction causes loss of information for another. Inconsistent retrieval –Partial, incomplete results of one transaction are retrieved by another. 17

CSE 486/586, Spring 2012 Lost Update Problem One transaction causes loss of info. for another: consider three account objects Transaction T1Transaction T2 balance = b.getBalance() b.setBalance(balance*1.1) b.setBalance = (balance*1.1) a.withdraw(balance* 0.1) c.withdraw(balance*0.1) T1/T2’s update on the shared object, “b”, is lost a: b:c: 280 c: 80 a: 220 b: 220 b:

CSE 486/586, Spring 2012 Inconsistent Retrieval Problem Partial, incomplete results of one transaction are retrieved by another transaction. Transaction T1Transaction T2 a.withdraw(100) total = a.getBalance() total = total + b.getBalance b.deposit(100) total = total + c.getBalance T1’s partial result is used by T2, giving the wrong result a: b: 00 a: c: total 300 b:

CSE 486/586, Spring 2012 Concurrency Control: Providing “Correct” Interleaving An interleaving of the operations of 2 or more transactions is said to be serially equivalent if the combined effect is the same as if these transactions had been performed sequentially (in some order). Transaction T1 Transaction T2 balance = b.getBalance() b.setBalance = (balance*1.1) balance = b.getBalance() b.setBalance(balance*1.1) a.withdraw(balance* 0.1) c.withdraw(balance*0.1) a: b:c: 278 c: a: 242 b: == T1 (complete) followed by T2 (complete)

CSE 486/586, Spring 2012 CSE 486/586 Administrivia Midterm: 3/5 (Monday) in class –45 minutes –Everything up to Wednesday –1-page cheat sheet is allowed. –You need to turn in your cheat sheet at the end of your exam. Please start project 1 as soon as possible! 21

CSE 486/586, Spring Acknowledgements These slides contain material developed and copyrighted by Indranil Gupta (UIUC).