Fast Transaction Logging for Smartphones Hao Luo , University of - - PowerPoint PPT Presentation

fast transaction logging for smartphones
SMART_READER_LITE
LIVE PREVIEW

Fast Transaction Logging for Smartphones Hao Luo , University of - - PowerPoint PPT Presentation

Fast Transaction Logging for Smartphones Hao Luo , University of Nebraska Lincoln Hong Jiang , University of Texas Arlington Zhichao Yan , University of Texas Arlington Yaodong Yang , University of Nebraska Lincoln 1 Outline Introduction


slide-1
SLIDE 1

1

Fast Transaction Logging for Smartphones

Hao Luo, University of Nebraska Lincoln Hong Jiang, University of Texas Arlington Zhichao Yan, University of Texas Arlington Yaodong Yang, University of Nebraska Lincoln

slide-2
SLIDE 2

2

  • Introduction
  • Logging Overhead in Mobile Databases
  • Design of xLog
  • Evaluation
  • Conclusion

Outline

slide-3
SLIDE 3

3

  • The smartphones and tablets have become

ubiquitous.

  • Storage subsystem impacts the application

performance.

  • Database
  • File system

Introduction

slide-4
SLIDE 4

4

  • Database engines has become a crucial part
  • f data management in mobile systems.
  • SQLite
  • LevelDB
  • Mobile databases employ logging to ensure

data persistency

  • Atomicity
  • Consistency
  • Durability

Introduction

slide-5
SLIDE 5

5

  • Journal of journaling (JOJ) anomaly

drastically slows down the mobile databases

  • Breaks the sequential pattern of log I/O
  • Writes more data.

Introduction

slide-6
SLIDE 6

6

Transaction Commit Path

DB file Log file A

Memory

slide-7
SLIDE 7

7

Transaction Commit Path

DB file Log file A’

Memory

slide-8
SLIDE 8

8

Transaction Commit Path

DB file Log file A’

Memory Upon Txn Commit

slide-9
SLIDE 9

9

  • Value Logging
  • Logs after-image of the database pages
  • Used by SQLite
  • Command Logging
  • Logs transaction logic (e.g., SQL query)
  • Used by LevelDB

Transaction Logging

slide-10
SLIDE 10

10

  • Logs modified database pages.
  • Header + modified pages
  • 4KB page size
  • fsync() upon transaction commit.

SQLite Write Ahead Log

slide-11
SLIDE 11

11

  • Logs transaction logic.
  • Put(): kTypeValue + key + value
  • Delete(): kTypeDeletion + key
  • fsync() upon commit (in synchronous mode)

LevelDB Logging

slide-12
SLIDE 12

12

  • To assess the overhead of logging in mobile

devices, we set up a simple benchmark test

  • 4 byte key, 100 byte value
  • 1000 insertion
  • Sequential / Random key order
  • Samsung Galaxsy S4
  • Run the benchmark on different

configurations

  • DB engine: SQLite, LevelDB
  • File system: Ext4, F2FS

Logging Overhead

slide-13
SLIDE 13

13

Logging Overhead

slide-14
SLIDE 14

14

Log File Size

500 1000 1500 2000 2500 3000 3500 Seq Rnd Seq Rnd LevelDB SQLite

Log File Size (KB)

Ext4 F2FS

slide-15
SLIDE 15

15

  • Log record size
  • SQLite: header + key + value (130 Byte)
  • LevelDB: header + modified pages (several KB)
  • SQLite’s value logging writes significantly

more data to the log files.

Log File Size

slide-16
SLIDE 16

16

Data Written to Log File

1000 2000 3000 4000 5000 6000 7000 8000 Seq Rnd Seq Rnd LevelDB SQLite

Data Written to Log File (KB)

Ext4 F2FS

slide-17
SLIDE 17

17

  • File system block
  • Data are flushed at file system block boundaries.
  • Usually 4KB in mobile devices.

Data Written to Log File

slide-18
SLIDE 18

18

Data Written to Device

5000 10000 15000 20000 25000 30000 Seq Rnd Seq Rnd LevelDB SQLite

Data Written to Device (KB)

Ext4 F2FS

slide-19
SLIDE 19

19

  • Nearly non-volatile memory in smartphones
  • Takes advantage of battery-backed nature of

mobile devices.

  • Data survive almost all the failure conditions.
  • Application crash
  • Kernel panic
  • Hard reset

qNVRAM

slide-20
SLIDE 20

20

xLog

Android Binder App App xLog Service Process qNVRAM buffer Log file

slide-21
SLIDE 21

21

  • Microbenchmark
  • Raw performance of the xLog
  • Different log record size

Evaluation

slide-22
SLIDE 22

22

Micro-benchmark Performance

slide-23
SLIDE 23

23

Micro-benchmark Write Amplification

slide-24
SLIDE 24

24

  • Micro-benchmark
  • Raw performance of the xLog
  • Different log record size
  • Macro-benchmark
  • Transaction latency of LevelDB
  • xLog v.s. write()+fsync()
  • Different size of value

Evaluation

slide-25
SLIDE 25

25

Evaluation

192 231 265 278 2050 2104 2174 2417 500 1000 1500 2000 2500 3000 100 400 800 1600 100 400 800 1600 xLog write()+fsync() Average Latency (µs) Value Size (Byte) Logging Other

slide-26
SLIDE 26

26

  • In this paper we present xLog, a fast transaction

logging service that uses qNVRAM as a buffer, for Android smartphones.

  • xLog logs up to 77x times faster than the

tranditional logging scheme

  • xLog drastically reduces the write

amplification from 122x to 1.6x.

Conclusion

slide-27
SLIDE 27

27

Q & A

Thank you!