Making SQLite Truly Lite Jong-Hyeok Park, Gihwan Oh, Sang-Won Lee - - PowerPoint PPT Presentation

making sqlite truly lite
SMART_READER_LITE
LIVE PREVIEW

Making SQLite Truly Lite Jong-Hyeok Park, Gihwan Oh, Sang-Won Lee - - PowerPoint PPT Presentation

SQL Statement Logging for Making SQLite Truly Lite Jong-Hyeok Park, Gihwan Oh, Sang-Won Lee Outline About SQLite Motivation Problem Definition Why Logical Logging? SQLite/SSL Architecture and Implementation Performance


slide-1
SLIDE 1

SQL Statement Logging for Making SQLite Truly Lite

Jong-Hyeok Park, Gihwan Oh, Sang-Won Lee

slide-2
SLIDE 2

Outline

▶About SQLite ▶Motivation ▪ Problem Definition ▪ Why Logical Logging? ▶SQLite/SSL ▪ Architecture and Implementation ▶Performance Evaluation ▶Conclusion

slide-3
SLIDE 3

De-facto standard mobile DBMS Productivity Solid transactional support Lightweight codebase

slide-4
SLIDE 4

SQLite is NOT LITE

INSERT INTO chat V ALUES ( “hi” ); UPDATE chat SET msg = “hello” where rid = 1;

Auto-Commit Force-Write Block Interface Journaling File system Metatdata

Huge Write Amplification

“Hi”

Durability & Atomicity

Block Interface Flash Storage (e.g. SD Card, UFS)

Journal file SQLite Database Files (per Application)

SQLite (Library)

B-tree module

insert/delete/update/ tx_begin/tx_commit/tx_abort

Buffer Cache

page

page page page

Durability Performance Life span

slide-5
SLIDE 5

Physical Aries-style Physiological Logical

Method

Page-wise Delta SQL statement

Scheme

Vanilla SQLite SQLite/PPL [VLDB 15] SQLite/SSL

Log Size Recovery

[Gray 90] J. Gray and A. Router. Transaction Processing: Concepts and Techniques. Morgan Kaufmann, 1933. [VLDB 15 ] G. Oh, S. Kim, S.-W. Lee, and B. Moon. SQLite Optimization with Phase Change Memory for Mobile Applications. Proceedings of VLDB Endowment,8(12), Aug. 2015.

Alternative Logging Mechanisms [Gray 90]

slide-6
SLIDE 6

Why We Revisit Logical Logging?

[CSUR 83] T. H¨arder and A. Reuter. Principles of Transaction-Oriented Database Recovery. ACM Computing Survey, 15(4):287–317, 1983. [ICDE 14] N. Malviya, A. Weisberg, S. Madden, and M. Stonebraker. Rethinking Main Memory OLTP Recovery. In IEEE 30th International Conference on Data Engineering (ICDE 2014), pages 604–615, 2014.

< Sequence of page-write request in SQLite > Technical Preconditions

Single User Strong Update Locality Transaction Consistent Checkpoint Mechanism

[Gray 90, CSUR 83, ICDE 14]

slide-7
SLIDE 7

Why Logical Logging? (2)

< SQLite W AL Mechanism> Technical Preconditions

Single User Strong Update Locality Transaction Consistent Checkpoint Mechanism

[Gray 90, CSUR 83, ICDE 14]

WAL Mode

Database File WAL File

P1_new

  • TX Completion -

… Pn_new fsync() … P1_new … Pn_new fsync() Checkpoint

WAL File FULL

[CSUR 83] T. H¨arder and A. Reuter. Principles of Transaction-Oriented Database Recovery. ACM Computing Survey, 15(4):287–317, 1983. [ICDE 14] N. Malviya, A. Weisberg, S. Madden, and M. Stonebraker. Rethinking Main Memory OLTP Recovery. In IEEE 30th International Conference on Data Engineering (ICDE 2014), pages 604–615, 2014.
slide-8
SLIDE 8

Why Logical Logging? (3)

▶ Byte Addressable ▶ Avoid I/O Stack ▶ Enable to realize full potential of Logical Logging

Applications Flash Storage

(e.g. eMMC, SD card)

DRAM PCM

Unified Memory System

Mmap( )

Byte-addressable DIMM Interface Block I/O Interface Host Storage

Non Volatile Memory & Logical Logging

UMS Architecture UMS Board [RSP 14]

slide-9
SLIDE 9

Design of SQLite/SSL

Flash Storage

(e.g. SD Card)

WAL journal file SQLite Database Files (per Application)

Buffer Cache

DRAM Mobile Application SQLite

(Library) B-tree module

insert/delete/update/ tx_begin/tx_commit/tx_abort No-force commit policy No-steal buffer policy SQL Interface Update Pages in Buffer Cache

Vanilla SQLite SSL Extension

Statement Log File (Flash-Only Case)

NVRAM:

PCM / NVDIMM

Byte-addressable mmap() interface (in case of flash) Call msync()

Statement Log Buffer (SLB) Statement Log Area (SLA)

page page page

slide-10
SLIDE 10

SLA = reset & No WAL file

  • Crashed during Normal shutdown

Create WAL journal file

SLA = reset & WAL = reset

  • Crashed during Initialization
  • Crashed after WAL-Checkpoint

No need to recovery

SLA = reset & WAL = in-use

  • Crashed after SSL-Checkpoint

Copy latest pages in WAL to DB file

SLA = in-use

  • Crashed prior to SSL-Checkpoint
  • Crashed during SSL-Checkpoint

Re-executes SQL statement in SLA

Recovery

slide-11
SLIDE 11

Performance Evaluation

UMS-Board : PCM as SLA log device

  • Reduce # of Checkpoints
  • Reduce # of Writes
  • No worse than Vanilla SQLite even in fully random workloads
  • In terms of recovery time, acceptable in practice (less than 1sec)

Andro Bench Gmail Kakao Talk Facebook Browser Random-A Twitter Random-B 0.2 1.2 1.7 3.2 3.2 5.2 13 38.7 WAL SQLite/PPL SQLite/SSL

I/O Time (sec)

B

369x 8x

A

slide-12
SLIDE 12

52.4 22.8 79.9 30.5 49 142.2 8.6 7.2 21 12.6 16.7 35.4

20 40 60 80 100 120 140 160

AndroBench Gmail KakaoTalk Facebook Browser Twitter

WAL SQLite/SSL

Performance Evaluation (2)

PC : SD Card as SLA log device

I/O Time (sec)

  • In Flash-only, 2 ~ 6 times better
  • Demonstrate that SQLite/SSL is quite effective without NVM

I/O Time (sec)

slide-13
SLIDE 13

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

AndroBench Gmail KakaoTalk Facebook Browser Twitter WAL SQLite/SSL

Recovery Performance

  • Acceptable in practice
  • Worst-case scenario : SLA = in-use (FULL)

Performance Evaluation (3)

보충 자료

Recovery Time (sec)

slide-14
SLIDE 14

Conclusion

▶ Transaction-consistent checkpoint in SQLite : WAL journaling can be naturally extended for TCC

SQLite/SSL demonstrates that logical logging can be fully and effectively realized in mobile DBMSs

▶ UFS with MRAM ▶ Add competitive edges to domestic storage

devices and mobile platforms

▶ Emerging NVMs : Byte-addressability makes SSL more attractive

Future Works

▶ Key observation about mobile workloads : Short transactions with strong update locality

slide-15
SLIDE 15

Q&A

slide-16
SLIDE 16

Recovery

Backup Slide

SLA = reset & No WAL file

  • Crashed during Normal shutdown

Create WAL journal file

SLA = reset & WAL = reset

  • Crashed during Initialization
  • Crashed after WAL-Checkpoint

No need to recovery

SLA = reset & WAL = in-use

  • Crashed after SSL-Checkpoint

Copy latest pages in WAL to DB file

SLA = in-use

  • Crashed prior to SSL-Checkpoint
  • Crashed during SSL-Checkpoint

Re-executes SQL statement in SLA

slide-17
SLIDE 17

UMS Board PC Processor Xilinx Zynq-7030 dual ARM Cotex-A9 1GHz Intel Core i7-3770 3.40 GHz DRAM 1GB 12 GB PCM 512 MB

  • Storage

SD Card : MB-MSBGA File system EXT4 Linux Kernel 3.9.0 Xilinx kernel 4.6 kernel

Performance Evaluation

Experimental Setup

Backup Slide

slide-18
SLIDE 18

Trace

Androbench Gmail KakaoTalk Facebook Browser Twitter

# of Files

1 1 1 11 6 17

DB size (MB)

0.19 0.74 0.45 1.95 2.51 6.08

Total # of TXs (Batch + Auto)

3,081 (2+3,079) 984 (806+178) 4,342 (432+3,910) 1,281 (262+1,019) 1,522 (1,439+29) 2,022 (17+2,005)

Total # of SQLs (Batch + Auto)

3,082 (3+3,079) 10,579 (10,419+178) 8,469 (4,559+3,910) 3,082 (2,063+1,019) 4,493 (4,464+29) 10,291 (448+2,005)

Page writes / T X

3.38 8.58 3.58 3.11 3.88 1.40

  • Avg. size of update

SQL stmt/TX (B)

215 1,913 1,094 1,094 8,304 506

Performance Evaluation

Mobile Workloads

Backup Slide