Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer,...

Preview:

Citation preview

1

Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems

Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith A. Smith, Harvard, Craig A.N. Soules CMU, Christopher A. Stein, Harvard

Presenters: Arjumand Younus and Muhammad Atif Qureshi

2

Outline

• Introduction: The Problem• Solutions– Synchronous Writes– Soft Updates– Journaling

• Comparative Evaluation– Feature Comparison– Measurements

• Conclusion

3

Problem Statement

• File system meta-data update problem– Interdependencies must be cared for during disk

updates

4

Metadata Operations

• Metadata operations modify the structure of the file system– Creating, deleting or renaming files, directories or

special files• Data must be written to disk in such a way

that the file system can be recovered to a consistent state after a system crash

5

Deleting a File (1/3)

abc

def

ghi

i-node-1

i-node-2

i-node-3

Assume we want to delete file “def”

6

Deleting a File (2/3)

abc

def

ghi

i-node-1

i-node-3

?

Cannot delete i-node before directory entry “def”

7

Deleting a File (3/3)

• Correct sequence is1. Write to disk directory block containing deleted

directory entry “def”2. Write to disk i-node block containing deleted i-

node• Leaves the file system in a consistent state

8

Creating a File (1/3)

abc

ghi

i-node-1

i-node-3

Assume we want to create new file “tuv”

9

Creating a File (2/3)

abc

ghi

tuv

i-node-1

i-node-3

?Cannot write directory entry “tuv” before i-node

10

Creating a File (3/3)

• Correct sequence is1. Write to disk i-node block containing new i-node2. Write to disk directory block containing new

directory entry

• Leaves the file system in a consistent state

11

Approaches to Metadata Management

• Synchronous Writes– FFS

• Ordered Writes– Soft Updats

• Logged Writes– Journaling

12

• Synchronous Writes

• Soft Updates

• Journaling– LFFS-file– LFFS-wafs

13

Synchronous Writes

• Used by FFS to guarantee consistency of metadata:– All metadata updates are done through blocking

writes• Increases the cost of metadata updates• Can significantly impact the performance of

whole file system

14

Soft Updates

• Uses delayed writes (write back)• Maintain dependency information about

cached pieces of metadata:– This i-node must be updated before/after this

directory entry• Guarantees that metadata blocks are written

to disk in the required order

15

Problems in Soft Updates (1/2)

• Soft Updates guarantee that file system will recover into a consistent state but not necessarily the most recent one– Some updates could be lost

• Cyclical dependencies:– Same directory block contains entries to be

created and entries to be deleted– These entries point to i-nodes in the same block

16

Problems in Soft Updates (2/2)

i-node-2 def

NEW xyz

NEW i-node-3

--- ----------

Block A Block B

We want to delete file “def”and create new file “xyz”

Cannot write block A before block B:

• Block A contains a new directory entry pointing to block B

Cannot write block B before block A:

• Block A contains a deleted directory entry pointing to block B

17

Solution to Soft Update Problem (1/2)

• Roll back metadata in one of the blocks to an earlier, safe state

• (Safe state does not contain new directory entry)

Block A

def

18

Solution to Soft Update Problem (2/2)

• Write first block with metadata that were rolled back (block A’ of example)

• Write blocks that can be written after first block has been written (block B of example)

• Roll forward block that was rolled back• Write that block• Breaks the cyclical dependency but must now

write twice block A

19

Journaling

• Logs metadata operations• Writes metadata in-place asynchronously• Write-ahead logging (WAL) protocol guarantees

recoverability.• Journaling systems can provide

– same durability semantics as FFS if log is forced to disk after each meta-data operation

– the laxer semantics of Soft Updates if log writes are buffered until entire buffers are full

• Will discuss two implementations– LFFS-file– LFFS-wafs

20

LFFS-file

• Maintains a circular log in a pre-allocated file in the FFS (about 1% of file system size)

• Buffer header of each modified block in cache identifies the first and last log entries describing an update to the block

• LFFS-file maintains its log asynchronously– Maintains file system integrity, but does not

guarantee durability of updates

21

LFFS-wafs (1/2)

• Implements its log in an auxiliary file system:Write Ahead File System (WAFS)– Can be mounted and unmounted– Can append data– Can return data by sequential or keyed reads

• Same checkpointing scheme and write-ahead logging protocol as LFFS-file

22

LFFS-wafs (2/2)

• Major advantage of WAFS is additional flexibility:– Can put WAFS on separate disk drive to avoid I/O

contention– Can even put it in NVRAM

• LFS-wafs normally uses synchronous writes – Metadata operations are persistent upon return

from the system call– Same durability semantics as FFS

23

• Properties of Metadata Operations

• Feature Comparison

• Experimental Setup & Measurements

24

Properties of Metadata Operations

• Integrity– The file system is always recoverable

• Durability– Updates are persistent once the call returns

• Atomicity– No partial metadata operations are visible after

recovery

25

Feature Comparison

26

Experimental Setup• Software

– Modified FreeBSD kernel and 2 journaling file system implementations (LFFS-wafs, LFFS-file)

• Hardware– 500 MHz Xeon Pentium III– 512 MB RAM– 3 x 9GB 10,000 RPM Seagate Cheetahs

• Compared performances of – Standard FFS– FFS mounted with the async option– FFS mounted with Soft Updates– FFS augmented with a file log using asynchronous log writes– FFS augmented with a WAFS log using

• Synchronous /asynchronous log writes • WAFS log on same/different drive

Microbenchmark

27

28

Comments on Microbenchmark Results

• FFS-async performs best• Original FFS, LFFS-wafs-2sync and

LFFS-wafs-1sync perform worst– Synchronous log updates are costly

• LFFS-file outperforms LFFS-wafs-2async and LFFS-wafs-1async– LFFS-file uses bigger block clusters

for log writes• Additional Results

– Read/write performance identical for all systems– All async systems have similar create throughput– Soft updates has great delete performance due to its ability to do

background work

29

Macrobenchmarks

• SSH-build– Unpacks, configures and builds ssh

• NetNews– Simulates the work of a news server

• SDET– Emulates user interactive software development workload

• Postmark– Designed to model the workload seen by ISPs under heavy

load: combination of email, news and e-commerce transactions

30

SSH Benchmark

31

NetNews Benchmark

32

Conclusions

• Journaling alone is not sufficient to “solve” the meta-data update problem– Cannot realize its full potential when synchronous

semantics are required• When that condition is relaxed, journaling and

Soft Updates perform comparably in most cases

33

Problems• Only a single file system with a single write-ordering model and a single

approach to writing the journal was evaluated.• Under what circumstances will soft update perform better and where will

Journaling perform better were not close ended.• It looks more of survey paper than conclusive stance over issues at hands.• High performance applicants will find it too naive to accept as practioners

guide (Who will be its first implementer).• Work load taken were too sparse and were too high level to close end a

discussion in particular discipline and does not offer a final say.• Survey was good, but analysis lacked to comprehend a pin pointed

viewpoint.• Performance over array (disks) must have appealed high performance

applicants, but paper does not provide any knowledge for such meaningful debate.

Recommended