b-tree structures over flash memory
DESCRIPTION
B-Tree Structures over Flash Memory. Speaker: 吳晋賢 (Chin-Hsien Wu) Embedded Computing and Applications Lab Department of Electronic Engineering National Taiwan University of Science and Technology, Taipei, Taiwan. Outline. Introduction Flash Memory Characteristics - PowerPoint PPT PresentationTRANSCRIPT
Speaker: 吳晋賢 (Chin-Hsien Wu)Embedded Computing and Applications LabDepartment of Electronic EngineeringNational Taiwan University of Science and Technology, Taipei, Taiwan
Slide 1
B-Tree Structures over Flash Memory
Outline
Slide 2
IntroductionFlash Memory CharacteristicsEfficient B-Tree Index Structures over Flash MemoryConclusion
Introduction
Slide 3
Storage SystemsEmbedded Systems or General Operating SystemsFile Systems
An interface for information retrieval and access.Physical Devices
A persistent (non-volatile) storage.Benefits of Flash Memory as Storage Systems
Shock ResistantNo mechanical gadgets.
Non-VolatilePersistent across power-failures.
Power EconomicRelatively to hard-disks.
Flash Memory is a good storage device for storage systems!
Introduction
Slide 4
Small updates could deteriorate flash-memory storage systems.B-Tree index structures over flash memory.
We aim at resolving these issues over flash memory storage systems!
Outline
Slide 5
IntroductionFlash Memory CharacteristicsEfficient B-Tree Index Structures over Flash MemoryConclusion
Organization of a Typical NAND Flash MemoryErase a block time (2ms) > Write a page time (200us) > Read a page time (50us)
Slide 6
……Block 0Block 0
Block 1Block 1
Block 2Block 2
Block 3Block 3 Erase Erase one one
blockblock
1 Page = 512B + 16B1 Page = 512B + 16B1 Block = 32 pages1 Block = 32 pages
……
Read/Read/Write one Write one
pagepage
Flash Memory Characteristics
512B
16BUser Area
Spare Area
Example 1: Out-place Update
Slide 7
Live pagesLive pages Free pagesFree pages
AA BB CC DD
Suppose that we want to update data A and B…Suppose that we want to update data A and B…
Flash Memory Characteristics
Flash Memory Characteristics
Slide 8
Dead pagesDead pages
AA BB CC DD AA BB
Example 1: Out-place Update
Example 2:Garbage Collection
Slide 9
A live pageA live page
A dead pageA dead pageA free pageA free page
This block is to be This block is to be recycled. recycled. (3 live pages and 5 dead (3 live pages and 5 dead pages)pages)
LL DD DD LL DD DD LL DD
LL LL DD LL LL LL FF DD
LL FF LL LL LL LL DD FF
FF LL LL FF LL LL FF DD
Flash Memory Characteristics
Example 2:Garbage Collection
Slide 10
LL LL DD LL LL LL DD
LL FF LL LL LL LL DD
LL LL FF LL LL FF DD
LL
LL
DD DD DD DD
A live pageA live page
A dead pageA dead pageA free pageA free page
Live data are copied to Live data are copied to somewhere else.somewhere else.
LL
DD DDDDDD
Flash Memory Characteristics
Example 2:Garbage Collection
Slide 11
A live pageA live page
A dead pageA dead pageA free pageA free page
The block is then erased.The block is then erased.
Overheads: Overheads: •live data copying live data copying •block eraseing.block eraseing.
LL LL DD LL LL LL DD
LL FF LL LL LL LL DD
LL LL FF LL LL FF DD
LL
LL
FF FF FF FF FF FF FF FF
LL
Flash Memory Characteristics
Flash Memory Characteristics
Slide 13
GarbageCollection
AddressTranslation
FTL Layer
File system (FAT, ext2......)
Device Driver
fwrite(file,data)
Block write(LBA,size)
Flash I/O Requests
Controlsignals
File Systems
process processprocess Applications
Flash-MemoryStorage System
Physical Devices(Flash Memory Banks)
Flash Memory Characteristics
Slide 14
Flash Translation Layer (FTL)
Userdata
.
.
.
Logical Address(array index)
Physical Address(block,page)
Physical Address(block,page)
Access LBA = 3
Address Translation Table(in main-memory) Flash memory
0,00,10,20,30,40,50,60,71,01,11,21,3
(0,3)(0,1)
(0,6)(0,4)(4,7)(1,0)(2,1)(1,2)(1,3)
01234567891011
.
.
.
Sparedata
Spare data
LBA=3;ECC=. . .;
Status=. . .;
GarbageCollection
AddressTranslation
FTL Layer
File system (FAT, ext2......)
Device Driver
fwrite(file,data)
Block write(LBA,size)
Flash I/O Requests
Controlsignals
File Systems
process processprocess Applications
Flash-MemoryStorage System
Physical Devices(Flash Memory Banks)
Outline
Slide 15
IntroductionFlash Memory CharacteristicsEfficient B-Tree Index Structures over Flash MemoryConclusion
Why Research On Index Structures Over Flash Memory ?
Slide 16
Now, a 16G bit NAND flash-memory chip (SAMSUNG K9WAG08U1M flash memory chips) is available in the market. Flash memory could be considered as an alternative to
hard disks in many applications.
The implementation of index structures, which are very popular in the organization of data on disks, must be considered regarding flash memory.
Efficient B-Tree Index Structures over Flash Memory
Slide 17
B-TreeB-Tree is one of the most popular data structures
adopted by database applications or databases systems (such as IBM DB2, Informix, Microsoft SQL Server, Oracle 8, and Sybase ASE), or even many well-known journaling file systems (such as XFS, JFS, and ReiserFS *)
The implementation of B-Tree index structures, which provide efficient data access on disks, must be considered regarding flash memory.
Efficient B-Tree Index Structures over Flash Memory
Motivation
100
A
B C
D E F G H I J
20 45 85 130 185 250
30 60 95 150 200
10 40 70 120 180 22097
Slide 18
A B-Tree Example
Efficient B-Tree Index Structures over Flash Memory
Slide 19
MotivationFor disk storage systems:
A B-Tree node occupies a fixed number of sectors.Large chunks are fetched from/committed to disks.It is very efficient for disk storage systems to do this.
For flash-memory storage systems:Intensively byte-wise operations are needed for B-Tree.A page must be written even if few bytes are modified.Free space is consumed very quickly due to the adoption of out-place
updates.Garbage collection will be triggered frequently, and the lifetime of flash
memory is reduced severely.
Efficient B-Tree Index Structures over Flash Memory
Slide 20
Logical view of a B-TreeIndex Structure
A
B C
D E F G H I J
100
30 60 95 150 200
10 40 70 97 120 180 220
Flash Translation Layer (FTL)
Flash Memory
BF
TL
ReservationBuffer
(in RAM)
A record
Primary keyContents
N20 25 85 180 185 250
20 25 85
I1 I2 I3
Index Unit
180 185 250
I4 I6I5
Sector 1Sector 1 Sector 2Sector 2
Efficient B-Tree Index Structures over Flash MemoryIndex Units vs. B-Tree
Nodes
Slide 21
Logical view of a B-TreeIndex Structure
A
B C
D E F G H I J
100
30 60 95 150 200
10 40 70 97 120 180 220
BF
TL
ReservationBuffer
(in RAM)
A record
Primary keyContents
N20 25 85 180 185 250
Flash Translation Layer (FTL)
Flash Memory
20 25 85
I1
I2
I3
Index Unit
180 185 250
I4
I6
I5
Sector 1Sector 1
Sector 2Sector 2I1 . . .I2 I3 Ik
A B-Tree Node(in RAM)
I3I1
I2Ik
Flash Memory
data_ptrparent_node
identifierprimary_key
left_ptrright_ptrop_flag
An Index Unit
Efficient B-Tree Index Structures over Flash Memory
Slide 22
The Commit PolicyLogical view of a B-Tree
Index Structure
A
B C
D E F G H I J
100
30 60 95 150 200
10 40 70 97 120 180 220
BF
TL
ReservationBuffer
(in RAM)
A record
Primary keyContents
N20 25 85 180 185 250
Flash Translation Layer (FTL)
Flash Memory
20 25 85
I1
I2
I3
Index Unit
180 185 250
I4
I6
I5
Sector 1Sector 1
Sector 2Sector 2
Suppose that a sector can store up to 3 index units
The technical issue is to minimize the number of sectors written to store the committed index units. The problem of packing index units into sectors that is reduced from the Bin-Packing problem is NP-Hard. A FIRST-FIT approximation algorithm was adopted in our experiments.
20 25 85
I1 I2 I3Index Unit: 180 185 250
I4 I6I5
Sector 1Sector 1 Sector 2Sector 2
D F H I JNode:
Sector:
Efficient B-Tree Index Structures over Flash Memory
Slide 23
The Node Translation Table
To construct node C, BFTL reads and parses sectors whose addresses’ are 23 and 100 To prevent the lists from being too long, the lists To prevent the lists from being too long, the lists should be compacted when needed.should be compacted when needed.
A
B
C
A
B
C
(a) The logical view of a B-tree (b) The node translation table
23
42 34 100 53
23 100
2 100 15
B
A
C
D E F G H II...
Efficient B-Tree Index Structures over Flash Memory
Slide 24
Performance EvaluationExperimental Setup
Flash-memory environmentsA 4MB NAND flash memory.The greedy block-recycling policy in garbage collection.
B-Tree environmentsThe fan-out of was 21.The size of a B-Tree node fitted in a sector (512 bytes).
Other parametersThe reservation buffer was configured to hold up to 60
records. The bound of the lengths of lists in the node translation
table was set as 4.
Efficient B-Tree Index Structures over Flash Memory
Slide 25
Experimental ResultsPerformance Metrics
Average response time.
Number of pages read and written.
Number of blocks erased.
Number of executions of the compact function
Efficient B-Tree Index Structures over Flash Memory
Slide 26
00.5
11.5
22.5
33.5
44.5
0 0.2 0.4 0.6 0.8 1
rs
Av
erag
e R
esp
on
se T
ime
(ms)
FTL BFTL
Average Response Time of Insertions after Inserting 30,000 Records
Rs: To control the distribution of the values of the inserted keys.
Rs 1Sequential
0Random
Efficient B-Tree Index Structures over Flash Memory
Slide 27
010000200003000040000
50000600007000080000
0 0.2 0.4 0.6 0.8 1
rs
Num
ber
of P
ages
Wri
tten
(Pag
es)
FTL BFTL
Number of Pages Written after Inserting 30,000 Records
Efficient B-Tree Index Structures over Flash Memory
Slide 28
0
50000
100000
150000
200000
250000
300000
0 0.2 0.4 0.6 0.8 1rs
Num
ber o
f Pag
es R
ead
(Pag
es)
FTL BFTL
Number of Pages Read after Inserting 30,000 Records
Efficient B-Tree Index Structures over Flash Memory
Slide 29
0
500
1000
1500
2000
0 0.2 0.4 0.6 0.8 1
rs
Num
ber
of E
rase
d B
lock
s
FTL BFTL
Number of Blocks Erased after Inserting 30,000 Records
Efficient B-Tree Index Structures over Flash Memory
Slide 30
01000
20003000
40005000
60007000
8000
0 0.2 0.4 0.6 0.8 1
rs
Num
ber
of E
xecu
tions
of
Com
pact
Fun
ctio
nBFTL
Number of Executions of Compact Function
after Inserting 30,000 Records
Conclusion
Slide 33
Index structures usually cause intensively find-grained updates which could damage the performance and the reliability of flash memory.
An Efficient B-Tree implementation is proposed to resolve the confliction between page-based operations and intensive byte-wise updates.
Performance and reliability of flash memory could be greatly improved.
Q & A
Slide 34
Thank YouQ & A