The Design and Implementation of a Log-Structured File System
description
Transcript of The Design and Implementation of a Log-Structured File System
![Page 1: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/1.jpg)
1
The Design and Implementation of a Log-Structured File System
Mendel Rosenblum and John K. OusterhoutPresented by Travis Bale
![Page 2: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/2.jpg)
2
Overview
Considerations for File Systems Problems with Existing File Systems Log-Structured File System Sprite LFS Implementation Details Sprite LFS Evaluation Solid State and Log-Structured File
Systems Questions / Discussion
![Page 3: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/3.jpg)
3
Considerations for File Systems Technology
Processors Disks Main Memory
Workloads Office Engineering
Environments
![Page 4: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/4.jpg)
4
Technology Considerations Processors
Getting exponential faster Unbalanced Systems
Disk Components of Disk Access▪ Transfer Bandwidth▪ Access Time
Main Memory Increasing at exponential rate Caches▪ Reduces read operations to disk▪ Write buffers
![Page 5: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/5.jpg)
5
Workload Considerations
Files tend to be small Small random disk I/Os Creation and deletion dominated by
updates to metadata
![Page 6: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/6.jpg)
6
Problems with Existing File Systems Information Spreading Synchronous Writes
![Page 7: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/7.jpg)
7
Information Spreading
Information is spread around the disk so small accesses are frequent
Unix FFS: separates files, file attributes, and directory entries
Unix FFS: takes five disk I/Os with seeks to create a new file
![Page 8: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/8.jpg)
8
Synchronous Writes
Defeats the use of cache as write buffer
Unix FFS: writes file attributes and metadata structures synchronously
NFS: has synchronous operations that improve crash recovery at cost of write performance
![Page 9: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/9.jpg)
9
Log-Structured File Systems Goal: Improve write performance
Buffer file system changes in a cache Write changes sequential in a single disk
operation Two issues in obtaining goal
Retrieving Information from the log Managing free space
![Page 10: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/10.jpg)
10
Sprite LFS Data Structures
![Page 11: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/11.jpg)
11
Sprite LFS structure compared to Unix FFS
![Page 12: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/12.jpg)
12
Cache
Reading File from Sprite LFS
Checkpoint Region
Inode Map
InodeData Block
![Page 13: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/13.jpg)
13
Free Space Management Fragmentation from deleted and overwritten
files Two approaches to reduce fragmentation
Threading▪ Leave live data in place and thread through the free extents▪ Reduces ability of sequential writes
Copying▪ Copy live data an append to the front of the log▪ Leaves larger free extents for use▪ Copying is very expensive on long-lived files
Sprite LFS uses a combination of both threading and copying
![Page 14: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/14.jpg)
14
Threading vs Copying
![Page 15: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/15.jpg)
15
Sprite LFS Segments
The disk is divided into large fixed-sized segments Either 512 kilobytes or 1 megabyte
Live data on segments is copied if segments need to be rewritten
System collects long-lived data together These segments can be skipped during
the copy procedure The log is threaded segment-by-
segment
![Page 16: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/16.jpg)
16
Sprite LFS Segment Cleaning Refers to copying of live data in
segments Read segments into memory Identify the live data▪ Segment Summary Block▪ Uid in inode maps
Write live data to smaller number of clean segments
No free list
![Page 17: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/17.jpg)
17
Segment Cleaning Policy Questions When should the segment cleaner
execute? How many segments should it clean
at a time? Which segments should be cleaned? How should the live blocks be
grouped when they are written out?
![Page 18: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/18.jpg)
18
Write Cost
Used to compare cleaning policies Average amount of time the disk is
busy per byte of new data written, including all the cleaning overheads
1.0 is perfect while higher means fractions of disk bandwidth are being utilized
![Page 19: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/19.jpg)
19
Write Cost of Sprite LFS
![Page 20: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/20.jpg)
20
Cleaning policy simulation Models file system as a fixed number
of 4-kbyte files Simulator overrides data by using
different access patterns Uniform Hot-and-Cold
![Page 21: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/21.jpg)
21
Greedy Cleaning Policy
Cleaner chooses the least utilized segments to clean
In the case of the Hot-and-Cold distribution the cleaner also sorts the live data by age Cold blocks tended to be in different
segments from Hot blocks
![Page 22: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/22.jpg)
22
Greedy Cleaning Policy Problems In Hot-and-Cold
performance was worse than random distribution
Cold Segments were not dropping to cleaning utilization thresholds quickly enough
![Page 23: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/23.jpg)
23
Cost-Benefit Policy Greedy Policy data shows that hot and cold
segments should be treated differently Cold segments should be cleaned at high utilization Hot segments should be cleaned at low utilization
Cost-Benefit policy rates each segment with the benefit of cleaning the segment and the cost of cleaning the segment
![Page 24: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/24.jpg)
24
Cost-Benefit Policy Evaluation
![Page 25: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/25.jpg)
25
Segment Cleaning Policy Segment Cleaning kicks in when the number of clean
segments drops below a threshold Cleans segments until number of clean segments
passes a threshold Threshold values do not seem to effect performance
greatly Cost-Benefit Policy is used in cleaning the segments Segment Usage table used to support the Cost-
Benefit Policy Contains number of live blocks and time of the most
recently accessed block Information used to compute the cost benefit to see if
segment should be cleaned
![Page 26: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/26.jpg)
26
Crash Recovery
Checkpoint Region Contains the addresses of all the blocks in the
inode map and segment usage table, plus the current time and a pointer to the last segment written
Performed at periodic intervals System uses the checkpoint region to return
log to this state Roll-Forward
Uses data after the check point to recover as many files as possible
![Page 27: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/27.jpg)
27
Micro Benchmarks File systems: Sprite LFS and Unix FFS Machine specs: Sun-4/260, with 32
megabytes of memory, a Sun SCSI3 HBA, and a Wren IV disk (1.3 MBytes/sec maximum transfer bandwidth, 17.5 milliseconds average seek time)
Disk Specs: 300 megabytes of usable storage SunOS (Unix FFS) using 8 kilobyte blocks Sprite FFS using 4 kilobyte blocks and 1
megabyte segment size
![Page 28: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/28.jpg)
28
Micro Benchmark Results
Small File Benchmark Large File Benchmark
![Page 29: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/29.jpg)
29
Cleaning Overhead Tested on 5 different file systems over 4 month period Waited several months to allow file system to balance Write cost smaller than simulated
This was due to block sizes used in simulation
![Page 30: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/30.jpg)
30
Segment Utilization for /user6
![Page 31: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/31.jpg)
31
Other Overheads
![Page 32: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/32.jpg)
32
Crash Recovery Times
![Page 33: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/33.jpg)
33
Log Structured File Systems and SSDs Log Structured File Systems write
files sequentially on disk Segment Cleaning
![Page 34: The Design and Implementation of a Log-Structured File System](https://reader033.fdocuments.in/reader033/viewer/2022061610/56816379550346895dd4582d/html5/thumbnails/34.jpg)
34
Questions