Distributed Systems 2006 Styles of Client/Server Computing.

Slides:



Advertisements
Similar presentations
Database Systems (資料庫系統)
Advertisements

Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
Database Systems, 8 th Edition Concurrency Control with Time Stamping Methods Assigns global unique time stamp to each transaction Produces explicit.
CS-550: Distributed File Systems [SiS]1 Resource Management in Distributed Systems: Distributed File Systems.
1 TRANSACTION & CONCURRENCY CONTROL Huỳnh Văn Quốc Phương Thái Thị Thu Thủy
Quick Review of Apr 29 material
Concurrency Control and Recovery In real life: users access the database concurrently, and systems crash. Concurrent access to the database also improves.
Distributed Systems Fall 2010 Transactions and concurrency control.
Transaction Management and Concurrency Control
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
Transaction Management and Concurrency Control
Transaction Management and Concurrency Control
Persistent State Service 1 Distributed Object Transactions  Transaction principles  Concurrency control  The two-phase commit protocol  Services for.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
What is a Transaction? Logical unit of work
Transaction Management
1 Transaction Management Database recovery Concurrency control.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 8-1 COS 346 Day 18.
Chapter 9 Transaction Management and Concurrency Control
9 Chapter 9 Transaction Management and Concurrency Control Hachim Haddouti.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
University of Pennsylvania 11/21/00CSE 3801 Distributed File Systems CSE 380 Lecture Note 14 Insup Lee.
Transactions and concurrency control
Transaction Management Chapter 9. What is a Transaction? A logical unit of work on a database A logical unit of work on a database An entire program An.
Distributed File Systems Concepts & Overview. Goals and Criteria Goal: present to a user a coherent, efficient, and manageable system for long-term data.
Distributed Deadlocks and Transaction Recovery.
08_Transactions_LECTURE2 DBMSs should guarantee ACID properties (Atomicity, Consistency, Isolation, Durability). This is typically done by guaranteeing.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
Transaction Communications Yi Sun. Outline Transaction ACID Property Distributed transaction Two phase commit protocol Nested transaction.
Distributed Transactions
ITEC 3220M Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220m.htm
Ch 10: Transaction Management and Concurrent Control.
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
1 Transactions Chapter Transactions A transaction is: a logical unit of work a sequence of steps to accomplish a single task Can have multiple.
11/7/2012ISC329 Isabelle Bichindaritz1 Transaction Management & Concurrency Control.
II.I Selected Database Issues: 2 - Transaction ManagementSlide 1/20 1 II. Selected Database Issues Part 2: Transaction Management Lecture 4 Lecturer: Chris.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
GLOBAL EDGE SOFTWERE LTD1 R EMOTE F ILE S HARING - Ardhanareesh Aradhyamath.
Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
1 Concurrency control lock-base protocols timestamp-based protocols validation-based protocols Ioan Despi.
IM NTU Distributed Information Systems 2004 Distributed Transactions -- 1 Distributed Transactions Yih-Kuen Tsay Dept. of Information Management National.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
1 Advanced Database Concepts Transaction Management and Concurrency Control.
1 Lecture 4: Transaction Serialization and Concurrency Control Advanced Databases CG096 Nick Rossiter [Emma-Jane Phillips-Tait]
Transaction Management and Concurrent Control
9 1 Chapter 9_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
NOEA/IT - FEN: Databases/Transactions1 Transactions ACID Concurrency Control.
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
10 1 Chapter 10_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
10 Transaction Management and Concurrency Control MIS 304 Winter 2005.
©Bob Godfrey, 2002, 2005 Lecture 17: Transaction Integrity and Concurrency BSA206 Database Management Systems.
18 September 2008CIS 340 # 1 Last Covered (almost)(almost) Variety of middleware mechanisms Gain? Enable n-tier architectures while not necessarily using.
Distributed Transactions What is a transaction? (A sequence of server operations that must be carried out atomically ) ACID properties - what are these.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
1 Concurrency Control. 2 Why Have Concurrent Processes? v Better transaction throughput, response time v Done via better utilization of resources: –While.
Transaction Management
Transaction Management and Concurrency Control
Transaction Properties
Database Processing: David M. Kroenke’s Chapter Nine: Part One
Chapter 10 Transaction Management and Concurrency Control
CS162 Operating Systems and Systems Programming Review (II)
Distributed File Systems
Distributed File Systems
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Distributed File Systems
Presentation transcript:

Distributed Systems 2006 Styles of Client/Server Computing

Distributed Systems Plan Styles Examples –Distributed file systems –Databases

Distributed Systems Basic Client/Server Properties Often little communication among clients Client to server ratio often high –Need for caching to achieve performance Access objects Access files Access relations

Distributed Systems Caching Storing shared state at both client and server –Requests may be handled locally State may become out-of- date if updated outside cache –Stale vs consistent Coherent caching –Guarantees that cache is not stale

Distributed Systems Stateless and Stateful Stateless architectures –Server does not track clients or ensure that cached data is up-to-date; clients independently responsible –Server may change state without notifying clients; thus shared state may become stale – caches as hints –May take load off server, simplifies error recovery –Distributed file systems Stateful architectures –Client make take actions, assuming that local state is correct –Servers typically need to track clients –Mimic behavior of non-replicated/- shared data – often locking of data –Transactional databases

Distributed Systems Distributed File Systems Two major stateless examples –Sun NFS on Unix/Linux/... –Windows NTFS Emulate local file access interface –File access on remote server using RPC –Caching to improve performance

Distributed Systems Sun NFS Developed by Sun in the 1980’s to provide a file system for diskless clients –NFS Version 4 (2000) introduces part state as in NTFS...

Distributed Systems Unix File Systems Virtual file system allows the use of many actual file systems Unix files are described using inodes –Contain mode, ownership information, time stamps, addresses of actual file blocks,... A directory is a file containing list of names and inodes Commands –E.g., mount, create, open, read, write

Distributed Systems NFS Operations RPC is not reliable, retry until success Mount –Client issues mount RPC request –Server checks request for validity. Is file available and is user allowed to access? –Server returns handle –Client stores in remote mount table Create, open –Client file system sees that path maps to remotely mounted file system, sends request to server –Server takes action, returns virtualized inode, vnode –Example of reliability problems: Create/delete used to create lock files vs timeouts Read, write –Uses vnodes –Cache vnodes and subset of blocks of files Freshness interval during which no cache validation is made Otherwise validation based on timestamps of files –Write-through cache policy Client applications see own modifications, modifications written back to server eventually Another source of problems: Even though cache is validated at client, server does not see complete state

Distributed Systems Real-World File Access? [Baker et al., 1991]: Study of file access patterns –All file access is sequential –Little sharing of files between applications – one application creates, other application reads –Files are either very short-lived or very long-lived Stateful distributed file systems –Andrew File System –Sprite file system –CODA –XFR

Distributed Systems Transactional Databases Assumptions –All stateful interaction client server –Interaction through short sequences of begin -> {read, update}* ->{commit, abort} issued at clients Structure interaction in transactions –Statefulness E.g., data read and written during transactions, ongoing transaction shared state 80% of all reliable distributed computing is based on transactions –Just like 80% of all programming is done in Visual Basic –In this course, transactions is just one reliability technique

Distributed Systems Properties of Transactions The basic unit of interaction with a database server Guaranteed properties (ACID) –Atomicity Each transaction is executed to completion or not at all Rollbacks may be necessary –Concurrency Transactions are minimized so as to maximize concurrency –Independence/Isolation Transactions execute independently on each other Effects of interactions do not interleave –Durability Results of committed transactions are persistent

Distributed Systems Serializability Isolation of concurrent transactions –Makes it easier to program database applications T1 and T2 executed concurrently/interleaved, effects will be as –T1 executed, then T2 executed, or –T2 executed, then T1 executed Simple, but slow approach: –Run transactions serially, i.e., no interleaving... The point here is that database server may optimize based on interleaved scheduling of transcation steps!

Distributed Systems Lost Update T1 –salary1 = doctor1.getSalary() –doctor1.setSalary(salary1 + bonus) –salary2 = doctor2.getSalary() –doctor2.setSalary(salary2 - bonus) T2 –salary1 = doctor1.getSalary() –doctor1.setSalary(salary1 + bonus) –salary3 = doctor3.getSalary() –doctor3.setSalary(salary3 - bonus)

Distributed Systems A Serializable Transaction Interleaving T1 –salary1 = doctor1.getSalary() –doctor1.setSalary(salary1 + bonus) –salary2 = doctor2.getSalary() –doctor2.setSalary(salary2 - bonus) T2 –salary1 = doctor1.getSalary() –doctor1.setSalary(salary1 + bonus) –salary3 = doctor3.getSalary() –doctor3.setSalary(salary3 - bonus)

Distributed Systems Inconsistent Retrievals T1 –ward1.discharge(patient) –ward2.admit(patient) T2 –sum += ward1.getNoPatients() –sum += ward2.getNoPatients()

Distributed Systems Achieving Serializability Avoiding conflicts –Result of T1.a.read and T2.a.write depends on order of execution –Result of T1.a.write and T2.a.write depends on order of execution For all a, if access to a is in conflict: –T1 needs to make all accesses to a before T2 accesses a Or vice versa

Distributed Systems Concurrency Control Locking (1) –Use read/write locks on objects that are accessed Read locks non-exclusive Write locks exclusive –Take these locks before objects are accessed Optimistic –Operate on tentative version of objects –Check with overlapping transactions just before commit whether there is a potential conflict on an object –If so, abort; otherwise commit Time-stamped –Timestamp transactions uniquely –Validate operations, e.g., Write allowed on an object only if read and written last by earlier transaction Read allowed on an object only if written last by earlier transaction

Distributed Systems Deadlock T1 –ward1.discharge(patient1) –ward2.admit(patient1) T2 –ward2.discharge(patient2) –ward1.admit(patient2) Locking (2)

Distributed Systems Avoiding Deadlocks Deadlock prevention –E.g., requesting locks in a predefined order Deadlock detection –Cycles in wait-for graph Timeout

Distributed Systems Ensuring Serializability Two-phase locking –Growing phase During transaction –Acquire write lock on object if it will update –Acquire read lock on object if it will only read –Don’t release! –Shrinking phase At abort/commit –Release locks when aborted or when updates are persistent Serializability? –Order of conflicting updates cannot change Reads commute If T2 updates an object after T1 has read or updated, T2 will have to wait If T2 reads an object after T1 has updated, T2 will have to wait

Distributed Systems Two-Phase Locking Example T1 –salary1 = doctor1.getSalary() –doctor1.setSalary(salary1 + bonus) –salary2 = doctor2.getSalary() –doctor2.setSalary(salary2 - bonus) T2 –salary1 = doctor1.getSalary() –doctor1.setSalary(salary1 + bonus) –salary3 = doctor3.getSalary() –doctor3.setSalary(salary3 - bonus)

Distributed Systems Summary Stateful and stateless client/server systems –Both use caching, difference is in whether it is coherent or not NFT as example of stateless system Databases as example of stateful system