Tianzheng Wang Ryan Johnson Alan Fekete Ippokratis Pandis The Serial Safety Net: Efficient concurrency control on modern hardware 1
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 LocksDisksThreadsMemoryDiskThreads
CC: current state of the art OCC (fast) SI (non-serializable) SSI (slow) OCC looks good. What’s the problem? Contentious TPC-C variant
CC: Robustness matters! 4 OCC (unfair) SI (non-serializable) SSI (slow) Need all three: fast, fair, serializable Contentious TPC-C variant with retries
The Serial Safety Net (SSN) 5 Some CC >= RC SSN Serializable execution Might admit anomalies Cheap certifier Works even if CC is buggy Aborts offenders Dictates access pattern
SSN: fast, fair, serializable 6 OCC SI SSI SSN
Database model 7 R1 R2 R3 R4... R3 Uncommitted write Invisible to other readers Multi-version database R1 CC decides which version to read Captures most CC schemes, incl. 2PL
Serialization graphs and cycles T1 r:y:w T2 w:x:r T3 r:x:w T1 T1 T2 T3 x y x T2 T1 (T3) commit time dependency order T1r(x,0)r(y,0)w(x,-11)C!! T2r(y,0)w(y,10)C!! T3r(x,0)r(y,10)C!! 8 SI read-only anomaly
T3 T2 T1 (T3) commit time dependency order Serialization graphs and cycles T1 commits last & “closes” the cycle “Hard” to detect T1 T3 “Easy” to detect T3 T1 SSN: efficiently detect T1 T3 9
“exclusion window” of T SSN in a nutshell 10 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 be a successor of T T might close a cycle
Visualizing SSN 11 Exclusion window satisfied T4 T1 π(T4) T2 T3 commit time dependency order π(T2) T5 T1 T4 T3 T2 (T1) T3 T4 T1 T2 π(T2) T2 T1 ?? π(T2) Exclusion window violation
Evaluation System – 4 x 6-core 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) and RC/SI+SSN SSI SSN allows more valid schedules than SSI or OCC
SSN provides “safe retry” 15 OCC SI (highest) and RC/SI+SSN SSI Higher is better
SSN is fair 16 SSI starves writers OCC starves readers 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!