making sqlite truly lite
play

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


  1. SQL Statement Logging for Making SQLite Truly Lite Jong-Hyeok Park, Gihwan Oh, Sang-Won Lee

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

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

  4. SQLite is NOT LITE Huge Write Amplification ALUES ( “hi” ); INSERT INTO chat V UPDATE chat SET msg = “hello” where rid = 1; “Hi” Auto-Commit SQLite (Library) Force-Write Block Interface B-tree module Journaling insert/delete/update/ tx_begin/tx_commit/tx_abort File system Metatdata Buffer Cache page page page Durability & page Atomicity Block Interface Durability Performance Life span Flash Storage (e.g. SD Card, UFS) SQLite Database Files Journal file (per Application)

  5. Alternative Logging Mechanisms [Gray 90] Aries-style Physical Logical Physiological Method Page-wise Delta SQL statement Scheme SQLite/PPL [VLDB 15] Vanilla SQLite 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.

  6. Why We Revisit Logical Logging? < Sequence of page-write request in SQLite > Technical Preconditions Single User Strong Update Locality Transaction Consistent Checkpoint Mechanism [Gray 90, CSUR 83, ICDE 14] [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.

  7. Why Logical Logging? (2) < SQLite W AL Mechanism> Technical Preconditions WAL Mode WAL File Database File P1_new Single User … Strong Update Pn_new Locality fsync() - TX Completion - WAL File Transaction … FULL Consistent P1_new Checkpoint … Mechanism Checkpoint Pn_new fsync() [Gray 90, CSUR 83, ICDE 14] [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.

  8. Why Logical Logging? (3) Non Volatile Memory & Logical Logging ▶ Byte Addressable ▶ Avoid I/O Stack ▶ Enable to realize full potential of Logical Logging UMS Architecture UMS Board [RSP 14] Applications Byte-addressable DIMM Interface Host Unified Memory System Mmap( ) DRAM PCM Block I/O Interface Flash Storage Storage (e.g. eMMC, SD card)

  9. Design of SQLite/SSL Mobile Application SQL Interface SQLite B-tree module Statement Log Buffer (Library) insert/delete/update/ (SLB) tx_begin/tx_commit/tx_abort Update Pages in Buffer Cache DRAM Buffer Cache NVRAM : Statement Log Area page page page PCM / (SLA) NVDIMM No-force commit policy Byte-addressable No-steal buffer policy mmap() interface (in case of flash) Call msync() Flash Storage Statement Log File WAL journal SQLite Database Files (e.g. SD Card) file (per Application) (Flash-Only Case) Vanilla SQLite SSL Extension

  10. Recovery SLA = reset & No WAL file SLA = reset & WAL = reset • Crashed during Normal shutdown • Crashed during Initialization • Crashed after WAL-Checkpoint Create WAL journal file No need to recovery SLA = reset & WAL = in-use SLA = in-use • Crashed after SSL-Checkpoint • Crashed prior to SSL-Checkpoint Copy latest pages in • Crashed during SSL-Checkpoint WAL to DB file Re-executes SQL statement in SLA

  11. Performance Evaluation UMS-Board : PCM as SLA log device • Reduce # of Checkpoints • Reduce # of Writes I/O Time (sec) WAL SQLite/PPL SQLite/SSL 369x 8x 38.7 13 1.2 1.7 3.2 3.2 5.2 0.2 Andro Bench Gmail Kakao Talk Facebook Browser Twitter Random-A Random-B A B • No worse than Vanilla SQLite even in fully random workloads • In terms of recovery time, acceptable in practice (less than 1sec )

  12. Performance Evaluation (2) PC : SD Card as SLA log device I/O Time (sec) 160 142.2 140 I/O Time (sec) 120 100 79.9 80 60 52.4 49 35.4 40 30.5 22.8 21 16.7 20 12.6 8.6 7.2 0 AndroBench Gmail KakaoTalk Facebook Browser Twitter WAL SQLite/SSL • In Flash-only, 2 ~ 6 times better • Demonstrate that SQLite/SSL is quite effective without NVM

  13. 보충 자료 Performance Evaluation (3) Recovery Performance • Acceptable in practice • Worst-case scenario : SLA = in-use (FULL) Recovery Time (sec) 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 AndroBench Gmail KakaoTalk Facebook Browser Twitter WAL SQLite/SSL

  14. Conclusion SQLite/SSL demonstrates that logical logging can be fully and effectively realized in mobile DBMSs ▶ Key observation about mobile workloads : Short transactions with strong update locality ▶ Transaction-consistent checkpoint in SQLite : WAL journaling can be naturally extended for TCC ▶ Emerging NVMs : Byte-addressability makes SSL more attractive Future Works ▶ UFS with MRAM ▶ Add competitive edges to domestic storage devices and mobile platforms

  15. Q&A

  16. Backup Slide Recovery SLA = reset & No WAL file SLA = reset & WAL = reset • Crashed during Normal shutdown • Crashed during Initialization • Crashed after WAL-Checkpoint Create WAL journal file No need to recovery SLA = reset & WAL = in-use SLA = in-use • Crashed after SSL-Checkpoint • Crashed prior to SSL-Checkpoint Copy latest pages in • Crashed during SSL-Checkpoint WAL to DB file Re-executes SQL statement in SLA

  17. Backup Slide Performance Evaluation Experimental Setup UMS Board PC Xilinx Zynq-7030 Processor Intel Core i7-3770 3.40 GHz dual ARM Cotex-A9 1GHz 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

  18. Backup Slide Performance Evaluation Mobile Workloads Trace Androbench Gmail KakaoTalk Facebook Browser Twitter 1 1 1 11 6 17 # of Files 0.19 0.74 0.45 1.95 2.51 6.08 DB size (MB) 3,081 984 4,342 1,281 1,522 2,022 Total # of TXs (Batch + Auto) (2+3,079) (806+178) (432+3,910) (262+1,019) (1,439+29) (17+2,005) 3,082 10,579 8,469 3,082 4,493 10,291 Total # of SQLs (Batch + Auto) (3+3,079) (10,419+178) (4,559+3,910) (2,063+1,019) (4,464+29) (448+2,005) 3.38 8.58 3.58 3.11 3.88 1.40 Page writes / T X Avg. size of update 215 1,913 1,094 1,094 8,304 506 SQL stmt/TX (B)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend