37
Logging in Flash-based Database Systems Lu Zeping 2009-06-27

Logging in Flash-based Database Systems

  • Upload
    wayne

  • View
    45

  • Download
    7

Embed Size (px)

DESCRIPTION

Logging in Flash-based Database Systems. Lu Zeping 2009-06-27. Outline . Characteristics of flash memory Log records in different kinds of Flash devices In Flash chips - IPL In SSD In USB – FlashLogging Future work Recovery processing Experiments of PTLog. Outline . - PowerPoint PPT Presentation

Citation preview

Page 1: Logging  in Flash-based Database Systems

Logging in Flash-based Database Systems

Lu Zeping2009-06-27

Page 2: Logging  in Flash-based Database Systems

2

Outline

• Characteristics of flash memory• Log records in different kinds of Flash devices – In Flash chips - IPL– In SSD– In USB – FlashLogging

• Future work– Recovery processing– Experiments of PTLog

Page 3: Logging  in Flash-based Database Systems

3

Outline

• Characteristics of flash memory• Log records in different kinds of Flash devices – In Flash chips - IPL– In SSD– In USB – FlashLogging

• Future work– Recovery processing– Experiments of PTLog

Page 4: Logging  in Flash-based Database Systems

4

Characteristics of flash memory

• No in-place update

× Out – place update

Page 5: Logging  in Flash-based Database Systems

5

Characteristics of flash memory

• No mechanical latency

MediaRandom-to-Sequential Ratio

Read workload Write workload

Magnetic Disk 4.3-12.3 4.5-10.0

Flash 1.1-1.2 2.4-14.2

Page 6: Logging  in Flash-based Database Systems

6

Characteristics of flash memory

• Asymmetric speed of read/write

Media Read Write Erase

Magnetic disk

12.7ms(2KB)

13.7ms(2KB)

N/A

Flash 80μs(2KB)

200μs(2KB)

1.5ms(128KB)

Page 7: Logging  in Flash-based Database Systems

7

The flash memory organization

Device : 1G

Block : 1024

Page : 64

2K Bytes 64 Bytes

Page Register

Page 8: Logging  in Flash-based Database Systems

8

The flash memory organization

Device : 1G

Block : 1024

Page : 64

2K Bytes 64 Bytes

Page Register

Page 9: Logging  in Flash-based Database Systems

9

Outline

• Characteristics of flash memory• Log records in different kinds of Flash devices – In Flash chips - IPL– In SSD– In USB – FlashLogging

• Future work– Recovery processing– Experiments of PTLog

Page 10: Logging  in Flash-based Database Systems

10

Design of IPL

• IPL : In-Page Logging

S. W. Lee, and B. Moon. Design of Flash-Based DBMS: An In-Page Logging Approach. SIGMOD 2007

DatabaseBuffer

in-memorydata page(8KB)

in-memorylog sector (512B)

Page 11: Logging  in Flash-based Database Systems

11

Design of IPL

S. W. Lee, and B. Moon. Design of Flash-Based DBMS: An In-Page Logging Approach. SIGMOD 2007

Flash Memory

log area (8KB): 16 sectors

Erase unit (Block): 128KB

15 data pages (8KB each)

….….….

……

……

Page 12: Logging  in Flash-based Database Systems

12

IPL Write

S. W. Lee, and B. Moon. Design of Flash-Based DBMS: An In-Page Logging Approach. SIGMOD 2007

DatabaseBuffer

in-memorydata page(8KB) in-memory

log sector (512B)

Flash Memory

log area (8KB): 16 sectors

Erase unit (Block): 128KB

15 data pages (8KB each)

….….….

……

……

Page 13: Logging  in Flash-based Database Systems

13

IPL Read

S. W. Lee, and B. Moon. Design of Flash-Based DBMS: An In-Page Logging Approach. SIGMOD 2007

DatabaseBuffer

in-memorydata page(8KB) in-memory

log sector (512B)

Flash Memory

log area (8KB): 16 sectors

Erase unit (Block): 128KB

15 data pages (8KB each)

….….….

……

……

Page 14: Logging  in Flash-based Database Systems

14

IPL Read

S. W. Lee, and B. Moon. Design of Flash-Based DBMS: An In-Page Logging Approach. SIGMOD 2007

DatabaseBuffer

in-memorydata page(8KB) in-memory

log sector (512B)

Flash Memory

log area (8KB): 16 sectors

Erase unit (Block): 128KB

15 data pages (8KB each)

….….….

……

……

Page 15: Logging  in Flash-based Database Systems

15

IPL Merge

S. W. Lee, and B. Moon. Design of Flash-Based DBMS: An In-Page Logging Approach. SIGMOD 2007

Flash Memory

….….….

….….….

……

……

……

……

….

Merge

….

Page 16: Logging  in Flash-based Database Systems

16

IPL Merge

S. W. Lee, and B. Moon. Design of Flash-Based DBMS: An In-Page Logging Approach. SIGMOD 2007

Flash Memory

….….….

….….….

……

……

……

……

….

Merge

….

Page 17: Logging  in Flash-based Database Systems

17

Outline

• Characteristics of flash memory• Log records in different kinds of Flash devices – In Flash chips - IPL– In SSD– In USB – FlashLogging

• Future work– Recovery processing– Experiments of PTLog

Page 18: Logging  in Flash-based Database Systems

18

SSD

• SSD = Flash memory + FTL ( Flash Translation Layer )

Page 19: Logging  in Flash-based Database Systems

19

To be used in……

• Accessing data in secondary storage is the main source of bottlenecks in database processing.

• Database table, index, log, temporary table and rollback segment could be created on physically separate storage devices .(SSD+ HDD)

• Log records are always appended to the end of log.

Page 20: Logging  in Flash-based Database Systems

21

TPC-B benchmark performance

B. Moon, C. Park, S. W. Lee. A Case for Flash Memory SSD in Enterprise Database Applications. SIGMOD 2008.

We used TPC-B to stress-test the log storage part of the commercial database server.

Due to the group commit mechanism, the average size of a single log write was slightly different between the two storage media.

Page 21: Logging  in Flash-based Database Systems

22

TPC-B benchmark performance

B. Moon, C. Park, S. W. Lee. A Case for Flash Memory SSD in Enterprise Database Applications. SIGMOD 2008.

In the case of SSD, the bottleneck in transaction throughput is the processing speed of CPU , while it was not in the case of disk.

Page 22: Logging  in Flash-based Database Systems

23

Outline

• Characteristics of flash memory• Log records in different kinds of Flash devices – In Flash chips - IPL– In SSD– In USB – FlashLogging

• Future work– Recovery processing– Experiments of PTLog

Page 23: Logging  in Flash-based Database Systems

USB flash memory advantages

• USB ports are widely available.

• USB bus bandwidth is good for logging.

• The hot-plug capability allows easy replacement of drives.

• The price of an individual drive is low.Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09. 24

Page 24: Logging  in Flash-based Database Systems

25

Flash devices and disk performance

Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09.

Page 25: Logging  in Flash-based Database Systems

26

Four key challenges

• Efficiently exploiting an array of flash drives.

• Coping with large variance of write latencies.

• Efficient recovery processing.

• Combining USB flash drives with disks for better logging and recovery performance.

Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09.

Page 26: Logging  in Flash-based Database Systems

27

Exploiting an array of flash drivesWhat’s wrong with the conventional array

organization?

Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09.

In-memory log buffer

……Devices : N

the stripe unit size is S

Data at address A are found on the k-th device, where k = A/S mod N.⌊ ⌋

Page 27: Logging  in Flash-based Database Systems

Unconventional array design

Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09.28

In-memory log buffer

Request queue

Worker Worker Worker……

LSN : Log Sequence Number

Page 28: Logging  in Flash-based Database Systems

29

Coping with outlier Writes

Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09.

• Sequential writes have large variance

•Outlier prediction is difficult.

Page 29: Logging  in Flash-based Database Systems

31

Outlier Detection and Hiding

Worker

In-memory log buffer

Worker

Measure the average sequential write latencies for different request sizes for a device.

Longer than twice the average latency?

Reissue the same request to a different ready device.

Non-decreasing LSN?

Outlier hiding area

Page 30: Logging  in Flash-based Database Systems

32

Efficient recovery processing

Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09.

Two main steps of recovery processing(i) Locating the log record corresponding to the LSN in the last checkpoint.

(ii) Scanning the log sequentially until the crash point.

Page 31: Logging  in Flash-based Database Systems

33

Flash devices and disk performance

Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09.

Page 32: Logging  in Flash-based Database Systems

34

FlashLogging design

Shimin Chen. FlashLogging: Exploiting Flash Devices for Synchronous Logging Performance. SIGMOD'09.

Request queue

Worker Worker Worker……

In-memory log buffer

Page 33: Logging  in Flash-based Database Systems

36

Outline

• Characteristics of flash memory• Log records in different kinds of Flash devices – In Flash chips - IPL– In SSD– In USB – FlashLogging

• Future work– Recovery processing– Experiments of PTLog

Page 34: Logging  in Flash-based Database Systems

37

Several recovery technologies Log Group

commitPTLog Shadow

pageTxFlash

Update Pattern

In-Place In-Place Out-Place Out-Place Out-Place

Concurrency Granularity

Record Record Page Segment/file

Page

Atomicity Type

Write atomicity

Write atomicity

Propagate atomicity

Propagate atomicity

Propagate atomicity

Commit Overhead

High Low Low High Low

Rollback Overhead

High High None None High

Logging I/O Type

Synchronous Synchronous Synchronous None None

GC overhead

None None Low Low High

Page 35: Logging  in Flash-based Database Systems

38

Outline

• Characteristics of flash memory• Log records in different kinds of Flash devices – In Flash chips - IPL– In SSD– In USB – FlashLogging

• Future work– Recovery processing– Experiments of PTLog

Page 36: Logging  in Flash-based Database Systems

39

Experiments of PTLog

• Berkeley DB

• Linux Nandsim nand_base.c 、 nand_bbt.c 、 nand_ids.c 、 nand_ecc.c 、 nandsim.c 、 diskonchip.c 、 cafe_nand.c 、 s3c2410.c

Page 37: Logging  in Flash-based Database Systems

40

Thank you !Q&A ?