Phase Reconciliation for Contended In-Memory Transactions Neha Narula, Cody Cutler, Eddie Kohler, Robert Morris MIT CSAIL and Harvard.

Slides:



Advertisements
Similar presentations
Serializability in Multidatabases Ramon Lawrence Dept. of Computer Science
Advertisements

CMPT 401 Summer 2007 Dr. Alexandra Fedorova Lecture III: OS Support.
CMPT 401 Dr. Alexandra Fedorova Lecture III: OS Support.
Optimistic Methods for Concurrency Control By : H.T. Kung & John T. Robinson Presenters: Munawer Saeed.
Threads Relation to processes Threads exist as subsets of processes Threads share memory and state information within a process Switching between threads.
Unit 9 Concurrency Control. 9-2 Wei-Pang Yang, Information Management, NDHU Content  9.1 Introduction  9.2 Locking Technique  9.3 Optimistic Concurrency.
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
Phase Reconciliation for Contended In-Memory Transactions Neha Narula, Cody Cutler, Eddie Kohler, Robert Morris MIT CSAIL and Harvard 1.
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 5: Tree-based Concurrency Control and Validation Currency Control Professor.
JavaSpaces and TSpaces Theresa Tamash CDA 5937 November 4, 2002.
Concurrency Control Nate Nystrom CS 632 February 6, 2001.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Piccolo – Paper Discussion Big Data Reading Group 9/20/2010.
Distributed Systems 2006 Styles of Client/Server Computing.
Transaction Management and Concurrency Control
Transaction Management and Concurrency Control
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
3.5 Interprocess Communication
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for Threads.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
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.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Optimizing RAM-latency Dominated Applications
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Computer System Architectures Computer System Software
Silo: Speedy Transactions in Multicore In-Memory Databases
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
Operating Systems Lecture 2 Processes and Threads Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of.
H-Store: A Specialized Architecture for High-throughput OLTP Applications Evan Jones (MIT) Andrew Pavlo (Brown) 13 th Intl. Workshop on High Performance.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
Transaction Lectured by, Jesmin Akhter, Assistant professor, IIT, JU.
April 26, CSE8380 Parallel and Distributed Processing Presentation Hong Yue Department of Computer Science & Engineering Southern Methodist University.
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
1 Multiversion Reconciliation for Mobile Databases Shirish Hemanath Phatak & B.R.Badrinath Presented By Presented By Md. Abdur Rahman Md. Abdur Rahman.
Department of Computer Science and Software Engineering
Introduction.  Administration  Simple DBMS  CMPT 454 Topics John Edgar2.
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
MULTIVIE W Slide 1 (of 21) Software Transactional Memory Should Not Be Obstruction Free Paper: Robert Ennals Presenter: Emerson Murphy-Hill.
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
Threads. Thread A basic unit of CPU utilization. An Abstract data type representing an independent flow of control within a process A traditional (or.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
SHUJAZ IBRAHIM CHAYLASY GNOPHANXAY FIT, KMUTNB JANUARY 05, 2010 Distributed Database Systems | Dr.Nawaporn Wisitpongphan | KMUTNB Based on article by :
On Transactional Memory, Spinlocks and Database Transactions Khai Q. Tran Spyros Blanas Jeffrey F. Naughton (University of Wisconsin Madison)
The Scalable Commutativity Rule: Designing Scalable Software for Multicore Processors Austin T. Clements, M. Frans Kaashoek, Nickolai Zeldovich, Robert.
Page 1 2P13 Week 1. Page 2 Page 3 Page 4 Page 5.
Lecture 4 Page 1 CS 111 Summer 2013 Scheduling CS 111 Operating Systems Peter Reiher.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Chapter 4 – Thread Concepts
Introduction to threads
Hathi: Durable Transactions for Memory using Flash
Transaction Management and Concurrency Control
Chapter 4 – Thread Concepts
Scaling a file system to many cores using an operation log
Chapter 6: CPU Scheduling
Lecture 6: Transactions
Transactions.
Chapter 10 Transaction Management and Concurrency Control
CSE8380 Parallel and Distributed Processing Presentation
Interpret the execution mode of SQL query in F1 Query paper
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Overall Kernel Module Design
Operating System Overview
Concurrency control (OCC and MVCC)
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

Phase Reconciliation for Contended In-Memory Transactions Neha Narula, Cody Cutler, Eddie Kohler, Robert Morris MIT CSAIL and Harvard

Cloud Computing and Databases Two trends: multicore and in-memory databases Multicore databases face increased contention due to skewed workloads and rising core counts

BEGIN Transaction ADD(x, 1) ADD(y, 2) END Transaction

Throughput on a Contentious Transactional Workload

Concurrency Control Forces Serialization core 0 core 1 core 2 ADD(x)ADD(y) time

BEGIN Transaction ADD(x, 1) ADD(y, 2) END Transaction

Multicore OS Scalable Counters core 0 core 1 core 2 x 0 = x 0 +1; x 1 = x 1 +1; x 2 = x 2 +1; Kernel can apply increments in parallel using per-core counters time

Multicore OS Scalable Counters core 0 core 1 core 2 x 0 = x 0 +1; x 1 = x 1 +1; x 2 = x 2 +1; print(x); x=x 0 +x 1 +x 2 ; print(x) To read per-core data, system has to stop all writes and reconcile x time

Can we use per-core data in complex database transactions?

BEGIN Transaction ADD(x, 1) ADD(y, 2) END Transaction BEGIN Transaction GET(x) GET(y) END Transaction

Challenges Deciding what records should be split among cores Transactions operating on some contentious and some normal data Different kinds of operations on the same records

Phase Reconciliation Database automatically detects contention to split a record among cores Database cycles through phases: split and joined OCC serializes access to non-split data Split records have assigned operations for split phases Doppel, an in-memory transactional database

Outline 1.Phases 2.Splittable operations 3.Doppel optimizations 4.Performance evaluation

Split Phase A transaction can operate on split and non-split data Split records are written to per-core (x) Rest of the records use OCC (u, v, w) OCC ensures serializability for the non-split parts of the transaction core 0 core 1 core 2 ADD(x) ADD(u) ADD(x) ADD(v) ADD(x) ADD(w) GET(x)GET( v) x 0 =x 0 +1 x 1 =x 1 +1 x 2 =x 2 +1 split phase

Reconciliation Cannot correctly process a read of x in current state Abort read transaction Reconcile per-core data to global store core 0 core 1 core 2 ADD(x) ADD(u) ADD(x) ADD(v) ADD(x) ADD(w) GET(x)GET( v) x=x+x 0 x 0 =0 x 0 =x 0 +1 x 1 =x 1 +1 x 2 =x 2 +1 x=x+x 1 x 1 =0 x=x+x 2 x 2 =0 split phase reconciliation

Joined Phase Wait until all processes have finished reconciliation Resume aborted read transactions using OCC Process all new transactions using OCC No split data core 0 core 1 core 2 ADD(x) ADD(u) ADD(x) ADD(v) ADD(x) ADD(w) GET(x)GET( v) x=x+x 0 x 0 =0 GET(x) GET(v) x 0 =x 0 +1 x 1 =x 1 +1 x 2 =x 2 +1 x=x+x 1 x 1 =0 x=x+x 2 x 2 =0 split phase joined phase reconciliation

Resume Split Phase When done, transition to split phase again Wait for all processes to acknowledge they have completed joined phase before writing to per-core data core 0 core 1 core 2 ADD(x) ADD(u) ADD(x) ADD(v) ADD(x) ADD(w) GET(x)GET( v) x=x+x 0 x 0 =0 GET(x) GET(v) x 0 =x 0 +1 x 1 =x 1 +1 x 2 =x 2 +1 ADD(x) ADD(v) x 1 =x 1 +1 x=x+x 1 x 1 =0 x=x+x 2 x 2 =0 ADD(x) ADD(v) x 2 =x 2 +1 split phase joined phase split phase reconciliation

Outline 1.Phases 2.Splittable operations 3.Doppel Optimizations 4.Performance evaluation

Transactions and Operations BEGIN Transaction (y) ADD(x,1) ADD(y,2) END Transaction Transactions are composed of one or more operations Only some operations are amenable to splitting

Supported Operations Splittable ADD(k,n) MAX(k,n) MULT(k,n) OPUT(k,v,o) TOPKINSERT(k,v,o ) Not Splittable GET(k) PUT(k,v)

MAX Example core 0 core 1 core 2 MAX(x,55) MAX(x,10) MAX(x,21) x 0 = MAX(x 0,55) x 1 = MAX(x 1,10) x 2 = MAX(x 2,21) x 0 = 55 x 1 = 10 x 2 = 21 Each core keeps one piece of summarized state x i MAX is commutative so results can be determined out of order

MAX Example core 0 core 1 core 2 MAX(x,55) MAX(x,10) MAX(x,21) x 0 = MAX(x 0,55) x 1 = MAX(x 1,10) x 2 = MAX(x 2,21) x 0 = 55 x 1 = 27 x 2 = 21 Each core keeps one piece of summarized state x i MAX is commutative so results can be determined out of order MAX(x,27) x 1 = MAX(x 1,27) MAX(x,2) x 1 = MAX(x 1,2) x = 55

MAX Example core 0 core 1 core 2 MAX(x,55) MAX(x,10) MAX(x,21) x 0 = MAX(x 0,55) x 1 = MAX(x 1,10) x 2 = MAX(x 2,21) x 0 = 55 x 1 = 27 x 2 = 21 Each core keeps one piece of summarized state x i MAX is commutative so results can be determined out of order MAX(x,27) x 1 = MAX(x 1,27) MAX(x,2) x 1 = MAX(x 1,2) x = 55

What Can Be Split? Operations that can be split must be: –Commutative –Pre-reconcilable –On a single key

What Can’t Be Split? Operations that return a value –ADD_AND_GET(x,4) Operations on multiple keys –ADD(x,y) Different operations in the same phase, even if arguments make them commutative –ADD(x,0) and MULT(x,1)

Outline 1.Phases 2.Splittable operations 3.Doppel Optimizations 4.Performance evaluation

Batching Transactions core 0 core 1 core 2 ADD(x) ADD(u) ADD(x) ADD(v) ADD(x) ADD(w) GET(x)GET( v) x=x+x 0 x 0 =0 GET(x) GET(v) x 0 =x 0 +1 x 1 =x 1 +1 x 2 =x 2 +1 x=x+x 1 x 1 =0 x=x+x 2 x 2 =0 split phase joined phase reconciliation

Batching Transactions Don’t switch phases immediately; stash reads Wait to accumulate stashed transactions Batch for joined phase core 0 core 1 core 2 ADD(x) ADD(u) ADD(x) ADD(v) ADD(x) ADD(w) GET(x)GET( v) x=x+x 0 x 0 =0 GET(x) GET(v) x 0 =x 0 +1 x 1 =x 1 +1 x 2 =x 2 +1 x=x+x 1 x 1 =0 x=x+x 2 x 2 =0 split phase joined phase reconciliation GET(x) ADD(x) ADD(v) x 1 =x 1 +1

Ideal World Transactions with contentious operations happen in the split phase Transactions with incompatible operations happen correctly in the joined phase

How To Decide What Should Be Split Data Database starts out with no split data Count conflicts on records –Make key split if #conflicts > conflictThreshold Count stashes on records in the split phase –Move key back to non-split if #stashes too high

Outline 1.Phases 2.Splittable operations 3.Data classification 4.Performance evaluation

Performance Contention vs. parallelism What kinds of workloads benefit? A realistic application: RUBiS Doppel implementation: Multithreaded Go server; worker thread per core All experiments run on an 80 core intel server running 64 bit Linux 3.12 Transactions are one-shot procedures written in Go

Parallel Performance on Conflicting Workloads Throughput (millions txns/sec) 20 cores, 1M 16 byte keys, transaction: ADD(x,1)

Increasing Performance with More Cores 1M 16 byte keys, transaction: ADD(x,1) all writing same key

Varying Number of Hot Keys 20 cores, transaction: ADD(x,1)

How Much Stashing Is Too Much? 20 cores, transactions: LIKE read, LIKE write

RUBiS Auction application modeled after eBay –Users bid on auctions, comment, list new items, search 1M users and 33K auctions 7 tables, 26 interactions 85% read only transactions More contentious workload –Skewed distribution of bids –More writes

StoreBid Transaction BEGIN Transaction (bidder, amount, item) num_bids_item = num_bids_item + 1 if amount > max_bid_item: max_bid_item = amount max_bidder_item = bidder bidder_item_ts = Bid{bidder, amount, item, ts} END Transaction

StoreBid Transaction BEGIN Transaction (bidder, amount, item) ADD(num_bids_item,1) MAX(max_bid_item, amount) OPUT(max_bidder_item, bidder, amount) PUT(new_bid_key(), Bid{bidder, amount, item, ts}) END Transaction All commutative operations on potentially conflicting auction metadata

RUBiS Throughput Throughput (millions txns/sec) 20 cores, 1M users 33K auctions

Related Work Split counters in multicore OSes –Linux kernel Commutativity in distributed systems and concurrency control –[Shapiro ‘11] –[Li ‘12] –[Lloyd ‘12] –[Weihl ‘88] Optimistic concurrency control –[Kung ’81] –[Tu ‘13]

Summary Contention is rising with increased core counts Commutative operations are amenable to being applied in parallel, per-core We can get good parallel performance on contentious transactional workloads by combining per-core split data with concurrency control Neha Narula