TicToc: Time Traveling Optimistic Concurrency Control Xiangyao Yu 1 - - PowerPoint PPT Presentation

tictoc time traveling optimistic concurrency control
SMART_READER_LITE
LIVE PREVIEW

TicToc: Time Traveling Optimistic Concurrency Control Xiangyao Yu 1 - - PowerPoint PPT Presentation

TicToc: Time Traveling Optimistic Concurrency Control Xiangyao Yu 1 , Andrew Pavlo 2 , Daniel Sanchez 1 , Srinivas Devadas 1 Massachusetts Institute of Technology 1 Carnegie Mellon University 2 PHYSICAL VS LOGICAL TIME T1 T2 Lock Release Lock


slide-1
SLIDE 1

TicToc: Time Traveling Optimistic Concurrency Control

Xiangyao Yu1, Andrew Pavlo2, Daniel Sanchez1, Srinivas Devadas1

Massachusetts Institute of Technology1 Carnegie Mellon University2

slide-2
SLIDE 2

PHYSICAL VS LOGICAL TIME

2 ¡

Tuple A Tuple B

Lock Acquire Lock Release Read Lock Write Lock

T1 T2 Time

Two-Phase Locking (2PL)

Write Lock

Tuple A Tuple B

Write Lock

Timestamp Ordering (T/O)

Read

T1 @ ts = 1 T2 @ ts = 2

Write Lock

slide-3
SLIDE 3

TIMESTAMP ORDERING

3 ¡

Timestamp Allocation

(txns have unique timestamps)

  • Centralized Allocator

– Timestamp allocation is a scalability bottleneck

  • Synchronized Clock

– Clock skew causes unnecessary aborts

ts = __sync_fetch_and_add(&glob_ts, 1)

0 ¡ 5 ¡ 10 ¡ 15 ¡ 20 ¡ 25 ¡ 0 ¡ 20 ¡ 40 ¡ 60 ¡ 80 ¡

Throughput ¡ (Million ¡txn/s) ¡ Thread ¡Count ¡ T/O ¡ 2PL ¡

slide-4
SLIDE 4

TIMESTAMP ORDERING

4 ¡

Timestamp Allocation

(txns have unique timestamps)

Static Timestamp Assignment

T1@ts=1

  • Txns abort due to bad

timestamp assignment

T2@ts=2

BEGIN COMMIT

READ(A)

BEGIN COMMIT

WRITE(A)

T1@ts=2 T2@ts=1

BEGIN COMMIT

READ(A)

BEGIN ABORT

WRITE(A)

Time

slide-5
SLIDE 5

DATA DRIVEN TIMESTAMP MANAGEMENT

Traditional T/O

5 ¡

1. Acquire timestamp (TS) 2. Determine tuple visibility using TS

TicToc

1. Access tuples and remember their timestamp info. 2. Compute commit timestamp (CommitTS) No Timestamp Allocation Dynamic Timestamp Assignment Timestamp Allocation Static Timestamp Assignment

slide-6
SLIDE 6

OPTIMISTIC CONCURRENCY CONTROL (OCC)

Data wts

(Write Timestamp)

rts

(Read Timestamp)

Tuple Format

6 ¡

BEGIN COMMIT

READ PHASE VALIDATION PHASE WRITE PHASE

Read & Write Tuples Execute Transaction Compute CommitTS Decide Commit/Abort Update Database

slide-7
SLIDE 7

READ PHASE

READ(C) WRITE(A) READ(B)

Transaction

Write to local write set Read data and timestamps atomically

1 2 3 4

Logical Time

7 ¡

slide-8
SLIDE 8

VALIDATION PHASE

8 ¡

1 2 3 4

READ(C) WRITE(A) READ(B)

Logical Time

TXN

Step 1 Lock Write Set

slide-9
SLIDE 9

VALIDATION PHASE

9 ¡

1 2 3 4

READ(C) WRITE(A) READ(B)

TXN

Step 2 Compute CommitTS

CommitTS

Step 1 Lock Write Set Logical Time

slide-10
SLIDE 10

VALIDATION PHASE

10 ¡

1 2 3 4

READ(C) WRITE(A) READ(B)

TXN Case 1: latest version

Step 2 Compute CommitTS Step 1 Lock Write Set Step 3 Validate Read Set Logical Time

CommitTS

slide-11
SLIDE 11

VALIDATION PHASE

11 ¡

1 2 3 4

READ(C) WRITE(A) READ(B)

TXN Case 2: New version at/before CommitTS Case 1: latest version

Step 2 Compute CommitTS Step 1 Lock Write Set Step 3 Validate Read Set Logical Time

CommitTS

slide-12
SLIDE 12

VALIDATION PHASE

12 ¡

Case 2: New version at/before CommitTS Case 1: latest version

Step 2 Compute CommitTS Step 1 Lock Write Set Step 3 Validate Read Set

Case 3: New version after CommitTS 1 2 3 4

READ(C) WRITE(A) READ(B)

TXN

Logical Time

CommitTS

slide-13
SLIDE 13

TIME TRAVELING

13 ¡

BEGIN COMMIT READ(A) BEGIN COMMIT WRITE(A)

1 2 3 4 Tuple A

Txn 1 CommitTS Txn 2 CommitTS

Txn 1 Txn 2

Logical Time

Time

slide-14
SLIDE 14

TICTOC OPTMIZATIONS

  • No-wait locking in validation phase
  • Preemptive aborts
  • Timestamp history
  • Lower isolation levels

14 ¡

slide-15
SLIDE 15

EXPERIMENTAL SETUP

  • 4-socket, 40-core Machine (80 threads w/ hyper-

threading)

  • Main Memory DBx1000

– No logging – No B-tree (Hash indexing)

  • Concurrency Control Algorithms

– MVCC: HEKATON – OCC: SILO – 2PL: DL_DETECT, NO_WAIT

15 ¡

slide-16
SLIDE 16

YSCB Medium Contention

16 ¡

Throughput Abort Rate

TICTOC ¡ HEKATON ¡ DL_DETECT ¡ NO_WAIT ¡ SILO ¡

0 ¡ 0.1 ¡ 0.2 ¡ 0.3 ¡ 0.4 ¡ 0 ¡ 20 ¡ 40 ¡ 60 ¡ 80 ¡ Abort ¡Rate ¡ Thread ¡Count ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 0 ¡ 20 ¡ 40 ¡ 60 ¡ 80 ¡ Throughput ¡ (Million ¡txn/s) ¡ Thread ¡Count ¡

slide-17
SLIDE 17

YSCB High Contention

17 ¡

TICTOC ¡ HEKATON ¡ DL_DETECT ¡ NO_WAIT ¡ SILO ¡

0 ¡ 0.2 ¡ 0.4 ¡ 0.6 ¡ 0.8 ¡ 1 ¡ 0 ¡ 20 ¡ 40 ¡ 60 ¡ 80 ¡ Abort ¡Rate ¡ Thread ¡Count ¡ 0 ¡ 0.2 ¡ 0.4 ¡ 0.6 ¡ 0.8 ¡ 1 ¡ 0 ¡ 20 ¡ 40 ¡ 60 ¡ 80 ¡ Throughput ¡ (Million ¡txn/s) ¡ Thread ¡Count ¡

Throughput Abort Rate

slide-18
SLIDE 18

Xiangyao Yu yxy@mit.edu Andy Pavlo pavlo@cs.cmu.edu Daniel Sanchez sanchez@mit.edu Srinivas Devadas devadas@mit.edu

DBx1000 (https://github.com/yxymit/DBx1000)