On Transactional Memory, Spinlocks and Database Transactions Khai Q. Tran Spyros Blanas Jeffrey F. Naughton (University of Wisconsin Madison)

Slides:



Advertisements
Similar presentations
CM20145 Concurrency Control
Advertisements

Transactional Memory Parag Dixit Bruno Vavala Computer Architecture Course, 2012.
Concurrency Control III. General Overview Relational model - SQL Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Database Systems (資料庫系統)
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two actions are in conflict if  they operate on the same DB item,  they belong.
Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
Concurrency Control II
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17 Sections
Concurrency Control II. General Overview Relational model - SQL  Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Concurrency Control Part 2 R&G - Chapter 17 The sequel was far better than the original! -- Nobody.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. –Because disk accesses are.
Transactional Memory Overview Olatunji Ruwase Fall 2007 Oct
Data and Database Administration Chapter 12. Outline What is Concurrency Control? Background Serializability  Locking mechanisms.
Transactional Memory (TM) Evan Jolley EE 6633 December 7, 2012.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez-Martínez Electrical and Computer Engineering Department Lecture 16 – Intro. to Transactions.
Quick Review of Apr 29 material
ICS 421 Spring 2010 Transactions & Concurrency Control (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa.
Concurrency Control R &G - Chapter 19 Smile, it is the key that fits the lock of everybody's heart. Anthony J. D'Angelo, The College Blue Book.
[ 1 ] Agenda Overview of transactional memory (now) Two talks on challenges of transactional memory Rebuttals/panel discussion.
Chapter 15 Transaction Management. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Transaction basics Concurrency.
Transactions – T4.3 Title: Concurrency Control Performance Modeling: Alternatives and Implications Authors: R. Agarwal, M. J. Carey, M. Livny ACM TODS,
Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E. Ramadan, Aditya Bhandari, and Emmett Witchel - Presentation By Sathish P.
Unbounded Transactional Memory Paper by Ananian et al. of MIT CSAIL Presented by Daniel.
Concurrency Control John Ortiz.
Transaction. A transaction is an event which occurs on the database. Generally a transaction reads a value from the database or writes a value to the.
Why The Grass May Not Be Greener On The Other Side: A Comparison of Locking vs. Transactional Memory Written by: Paul E. McKenney Jonathan Walpole Maged.
Academic Year 2014 Spring Academic Year 2014 Spring.
Locking Key Ranges with Unbundled Transaction Services 1 David Lomet Microsoft Research Mohamed Mokbel University of Minnesota.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Reduced Hardware NOrec: A Safe and Scalable Hybrid Transactional Memory Alexander Matveev Nir Shavit MIT.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Lecture 21 Ramakrishnan - Chapter 18.
CS 245Notes 101 CS 245: Database System Principles Notes 10: More TP Hector Garcia-Molina.
Database Systems/COMP4910/Spring05/Melikyan1 Transaction Management Overview Unit 2 Chapter 16.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
Module Coordinator Tan Szu Tak School of Information and Communication Technology, Politeknik Brunei Semester
1 Concurrency Control II: Locking and Isolation Levels.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two schedules are conflict equivalent if:  Involve the same actions of the same.
II.I Selected Database Issues: 2 - Transaction ManagementSlide 1/20 1 II. Selected Database Issues Part 2: Transaction Management Lecture 4 Lecturer: Chris.
The Relational Model1 Transaction Processing Units of Work.
CS510 Concurrent Systems Why the Grass May Not Be Greener on the Other Side: A Comparison of Locking and Transactional Memory.
1 Concurrency Control Lecture 22 Ramakrishnan - Chapter 19.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Copyright © Curt Hill Concurrent Execution An Overview for Database.
© 2008 Multifacet ProjectUniversity of Wisconsin-Madison Pathological Interaction of Locks with Transactional Memory Haris Volos, Neelam Goyal, Michael.
1 Database Systems ( 資料庫系統 ) December 27, 2004 Chapter 17 By Hao-hua Chu ( 朱浩華 )
1 CSE232A: Database System Principles More Concurrency Control and Transaction Processing.
NOEA/IT - FEN: Databases/Transactions1 Transactions ACID Concurrency Control.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez-Martínez Electrical and Computer Engineering Department Lecture 16 – Intro. to Transactions.
1 Concurrency Control. 2 Why Have Concurrent Processes? v Better transaction throughput, response time v Done via better utilization of resources: –While.
Lecture 20: Consistency Models, TM
PHyTM: Persistent Hybrid Transactional Memory
Faster Data Structures in Transactional Memory using Three Paths
Transaction Management
Transaction Management
Hassium: Hardware Assisted Database Synchronization
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Distributed Transactions
Transactions and Concurrency
Transaction Management
Temple University – CIS Dept. CIS661 – Principles of Data Management
Lecture 23: Transactional Memory
CONCURRENCY Concurrency is the tendency for different tasks to happen at the same time in a system ( mostly interacting with each other ) .   Parallel.
CSE 542: Operating Systems
CSE 542: Operating Systems
Presentation transcript:

On Transactional Memory, Spinlocks and Database Transactions Khai Q. Tran Spyros Blanas Jeffrey F. Naughton (University of Wisconsin Madison)

Motivation Growing need for extremely high transaction (xact) processing rates. – Potential markets: financial trading (Wall Street), airlines, and retailers. – Focusing on extremely short xacts (no I/O, read and update a few records, a few hundreds of instructions). DBMS industry recognizes this need: – Some current startups: VoltDB and other. – Major DBMS vendors also considering this market. 2

Concurrency Control problem Need a lightweight CC for such short xacts. Historical approaches: Traditional db locks: – High overhead of acquiring and releasing locks: at least ins/lock, ≈ CPU time of a short xact. Run xacts serially, with no CC: – Garcia-Molina and Salem, 1984: Great for uniprocessor systems, but what about multi-cores? Is there a way to run short xacts on multiple cores at close to their no CC rates? 3

Can hardware help? The community has long investigated hardware support for DB performance: – Flash and SCM to mitigate slow disks – Multi-cores and GPUs for parallelism – FPGAs to implement basic DB query operations – But has not explored hardware assist for xact isolation. Can we also use hardware support to speed up short-xact workloads? 4

Our work Explore hardware primitives to support xact isolation. Perhaps raises more questions than it answers, due to: – Limitations of prototype hardware upon which to test – Simple workloads because of the limitations – Lack of consideration of many issues required for a complete solution. Still, results suggest this is worth exploring. 5

Hardware TM Idea: let pieces of code run atomically and in isolation on each core. Similar to optimistic CC in DBMS: –Keep track of xact’s read set and write set –Use a cache coherence protocol to detect conflicts (RW, WR, WW) –Abort xact if a conflict happens (restart the xact later.) 6

T2T3 HTM – a simple example 7 A B C D T1 Core 1 Core 2 E R W C’ A B R W D E’ commit W conflict! cache coherence protocol abort E’ D’ commit C’ Xact Read set Write set Xact Read set Write set T1 {A, B} {C} T2 {B, D} {E} T3 {A, D}

HTM: pros and cons Pros: very low overhead. Cons: trouble with high contention. 8 Scalability of HTM

Alternative: Spinlocks Spinlock: a lock where the thread simply waits and repeatedly checks until the lock becomes available. – Can be implemented with atomic instructions: test-and- set, compare-and-swap. Spinlocks as a CC method: – Associate each database object with a spinlock. – Acquire and release locks following 2PL protocol. – No lock manager, no lock table → problem with deadlock detection. 9

Spinlocks: deadlock detection/prevention No data structure to build the “waits-for” graph => hard to detect deadlocks. Solutions: – Approach 1: if objects accessed by xacts are known in advance, sort to prevent deadlocks. – Approach 2: if not, use time-out mechanism. 10

Experiments: HTM, spinlock and database lock Workload: – Database: Collections of objects, each object: (key, value) Database size = – Xacts: Read and update numbers of objects Less than 1000 instructions. – Workload contention: Vary degree to which the workload can be partitioned among cores (Perfect partitioning means no contention.) 11

Experiments: HTM, spinlock and database lock (2) Environment: – Hardware prototype of HTM (TM0): 16 cores, real hardware, fun and challenging! – TM Simulator: LogTM from Wisconsin GEMS project. 12

Implementation of database lock Simple implementation of the lock manager with out deadlock detection Sort objects in advance to prevent deadlocks Our purpose: get the lower bound of the lock manager performance. 13

Experiment 1: Overhead 14 (a) on TM0 (b) on LogTM

Experiment 2: Scalability – low contention 15 On LogTM, 10 reads + 10 writes/xact, 95% partitioned

Experiment 3: Scalability – high contention 16 On LogTM, 10 reads + 10 writes/xact, 0% partitioned

Summary Hardware support for very short transactions on multi-cores is intriguing and promising. – HTM works well under low contention. – Spinlocks work well under higher contention. – Both hardware support approaches completely dominate traditional db locks. A great deal of work remains to fully explore this area. 17