local filesystems (part 1) cps210 spring 2006. papers the design and implementation of a log-...

40
Local Filesystems (part 1) CPS210 Spring 2006

Upload: linda-blair

Post on 18-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Local Filesystems (part 1)

CPS210Spring 2006

Page 2: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Papers

The Design and Implementation of a Log-Structured File System Mendel Rosenblum

File System Logging Versus Clustering: A Performance Comparison Margo Seltzer

Page 3: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Surface organized into tracks

Page 4: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Parallel tracks form cylinders

Page 5: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Tracks broken up into sectors

Page 6: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Disk head position

Page 7: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Rotation is counter-clockwise

Page 8: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

About to read a sector

Page 9: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

After reading blue sector

After BLUE read

Page 10: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Red request scheduled next

After BLUE read

Page 11: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Seek to red’s track

After BLUE read Seek for RED

SEEK

Page 12: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Wait for red sector to reach head

After BLUE read Seek for RED Rotational latency

ROTATESEEK

Page 13: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Read red sector

After BLUE read Seek for RED Rotational latency After RED read

ROTATESEEK

Page 14: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Unix index blocks Intuition

Many files are small Length = 0, length = 1, length < 80, ...

Some files are huge (3 gigabytes) “Clever heuristic” in Unix FFS inode

12 (direct) block pointers: 12 * 8 KB = 96 KB Availability is “free” - you need inode to open() file

anyway 3 indirect block pointers

single, double, triple

Page 15: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Unix index blocks

106105

501502

102101

1615

1817

500100

1000 104103

2019

2221

2423

2625

2827

3029

3231

Page 16: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Unix index blocks

1615

1817

-1-1

-1

Direct blocks

Indirect pointerDouble-indirect

Triple-indirect

Page 17: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Unix index blocks

1615

1817

-1100

-1

2019

Page 18: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Unix index blocks

102101

1615

1817

500100

-1

2019

2221

2423

Page 19: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Unix index blocks

106105

501502

102101

1615

1817

500100

1000 104103

2019

2221

2423

2625

2827

3029

3231

Page 20: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Log-structured file system What is the high level motivation?

Caches are getting bigger Disk reads are less important Disk traffic will be dominated by writes

Why a log? Eliminate seeks (make all disk writes sequential) Easy crash-recovery

Most writes are small meta-data updates Consecutive small writes will trigger seeks Some file systems perform these synchronously

Page 21: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

LFS challenges

Writes are easier, what about reads?

How do we ensure large open spaces? Why does this matter?

Page 22: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

LFS on disk structures

Page 23: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Segment cleaner LFS requires large open spaces

Fragmentation will kill performance Use notion of segments

Large contiguous areas of live/dead data 512 kb or 1MB

Segment cleaner defragments disk Separate the old from the young Old data rarely changes Clean two differently

Page 24: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Threading vs copying

Thread between segments

Page 25: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Segment cleaning

Three steps Read segments into memory Identify live blocks in those segments Write live blocks to a small, clean

segment Must also update file inodes

Segment block summary for each segment

Page 26: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Segment block summaries Contains info about blocks in a

segment For each file data block

SBS has the file number and block number Also used to identify live/dead blocks

Use file number from SBS with actual inode If same, block is live If different, block is dead

Optimization: just keep inode versions

Page 27: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Cleaner policy questions

When should the cleaner run? Continuously, at night, high utilization

How many segments per cleaning? Tens, hundreds, …

Which segments should be cleaned?

How should live blocks be grouped?

Page 28: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Write cost

Percent of bandwidth used for new data 1.0 is perfect (we only write new data) 10.0 isn’t great (1/10 written data is new)

Ideal bimodal distribution of segments High utilization of old segments Low utilization of young segments Combines high utilization and low write cost

Page 29: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Initial simulation results

Surprise!

Page 30: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Why the surprise?

These segments decay slowly collecting dead blocks.In aggregate, they contain a lot of free blocks

Page 31: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Instead of greatest yield

Use cost-benefit analysis Benefit/cost =

(Yield * age)/cost = (1-u)*age/(1+u)

Result Clean cold segments at higher

utilization

Page 32: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Result

Page 33: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

What do LFS results really mean?

Workloads matter When is LFS better than FFS? When is FFS better than LFS?

Page 34: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

More terminology

Blocks Partial blocks, aka fragments Contiguous ranges of blocks, aka

clusters Want to allocate indoes + data

In same cylinder (no seeks) Want data

In clusters on same track (also no seeks)

Page 35: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Challenges for FFS

Reduce (eliminate?) synchronous writes

Avoid fragmentation Why are meta-data writes

synchronous?

Page 36: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Sequential performance vs file size

Four phase benchmark: Create Read Overwrite Delete

Ideal conditions Blank file system, no cleaner

Page 37: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Create results

Page 38: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Read results

Page 39: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Overwrite results

Page 40: Local Filesystems (part 1) CPS210 Spring 2006. Papers  The Design and Implementation of a Log- Structured File System  Mendel Rosenblum  File System

Delete results