tianzheng wang ryan johnson alan fekete ippokratis pandis the serial safety net: efficient...

17
Tianzheng Wang Ryan Johnson Alan Fekete Ippokratis Pandis The Serial Safety Net: Efficient concurrency control on modern hardware 1

Upload: prosper-simpson

Post on 21-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

1

Tianzheng Wang Ryan JohnsonAlan FeketeIppokratis Pandis

The Serial Safety Net: Efficient concurrency control on modern hardware

Modern HW: CPU on critical path

2

Low parallelism Focus: hide I/O stalls

Classic DBMS Modern DBMS

High parallelism Focus: minimize cycles

Main-memory OLTP: more pressure on CC

Locks Disks Threads Memory Disk Threads

3

CC: current state of the art

0 100000 200000 300000 400000 5000000.0

0.1

0.2

0.3

0.4

0.5

Throughput (ktps)

Abo

rts/

com

mit OCC (fast)

SI (non-serializable)

SSI (slow)

OCC looks good. What’s the problem?

Contentious TPC-C variant

24166

12

1

0 50000 100000 150000 200000 250000 300000 350000 4000000.0

1.0

2.0

3.0

4.0

Throughput (ktps)

Abo

rts/

com

mit

CC: Robustness matters!

4

OCC (unfair) SI (non-serializable)

SSI (slow)

Need all three: fast, fair, serializable

24

16

6

12

1

Contentious TPC-C variantwith retries

The Serial Safety Net (SSN)

5

SomeCC >= RC SSN

Serializable execution

Might admit anomalies Cheap certifier

Works even if CC is buggy

Aborts offenders

Dictates access pattern

0 50000 100000 150000 200000 250000 300000 350000 4000000.0

1.0

2.0

3.0

4.0

Throughput (ktps)

Abo

rts/

com

mit

SSN: fast, fair, serializable

6

OCC SI

SSI

SSN

7

Database model

R1 R2 R3 R4...

R3

Uncommitted write

Invisible to other readers

Multi-versiondatabase

R1 R1

CC decides whichversion to read

Captures most CC schemes, incl. 2PL

8

Serialization graphs and cycles

T1 r:y:w T2 w:x:r T3 r:x:w T1

T1

T2

T3

x

y

xT3

T2

T1

(T3)

com

mit

time

dependency order

T1 r(x,0) r(y,0) w(x,-11) C!!

T2 r(y,0) w(y,10) C!!

T3 r(x,0) r(y,10) C!!

SI read-onlyanomaly

9

T3

T2

T1

(T3)

com

mit

time

dependency order

Serialization graphs and cycles

T1 commits last & “closes”

the cycle “Hard” to detectT1 … T3

“Easy” to detectT3 T1

SSN: efficientlydetect T1 … T3

10“exclusion window” of T

SSN in a nutshell

Define π(T) = min {c(S) : T … S}

Define c(T) = “commit time of T”

Forbid $P T : π(T) ≤ c(P) ≤ c(T)

Track T’s earliest

successor

P might bea successor

of T

T might close a cycle

Visualizing SSN

11

Exclusion window satisfied

T4T1

π(T4)T2

T3

com

mit

time

dependency order

π(T2)T5

T1

T4

T3T2

(T1)

T3

T4

T1

T2

π(T2)

T2

T1??

π(T2)

Exclusion window violation

Evaluation• System– 4 x 6-core Xeon @ 1.8GHz, 64GB DRAM– A variant of Silo* that supports SI and RC– TPC-C w/ random warehouse selection– RC, SI, OCC (Silo), SSI, {SI, RC} + SSN

– What to test– General performance/scalability– Fairness for updates vs. reads– Robustness under retries

12* Tu et al, “Speedy transactions in multicore in-memory databases”, SOSP`13

SSN performs well

13

Higher is better

SSI

OCC

Low implementation overhead

SSN has low abort rate

14

Lower is better

OCC

SI (higher) andRC/SI+SSN

SSI

SSN allows more valid schedules than SSI or OCC

SSN provides “safe retry”

15

OCC

SI (highest) andRC/SI+SSN

SSI

Higher is better

16

SSN is fair

0

20

40

60

80

100

Ideal OCC SSI SI+SSN SI RC+SSN

% of

total

comm

its

DeliveryNew-Order

Order-StatusPayment

Stock-Level

SSI starveswriters

OCC starvesreaders

SSN fair to both R & W

Ideal OCC SSI SI SI+SSN RC+SSN

Conclusion

• Modern HW puts more pressure on CC– No tolerance for CC with “heavy touch”– Serializability becomes even harder

• Serial safety net – a cheap certifier– Serializable– Compatible with various CC schemes– Lightweight and balanced

17

Formal proofs (+ more details) in our paper

Thank you!