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

33
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 1

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

Page 1: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 2: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

2

Outline

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

• Comparative Evaluation– Feature Comparison– Measurements

• Conclusion

Page 3: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

3

Problem Statement

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

updates

Page 4: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 5: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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”

Page 6: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

6

Deleting a File (2/3)

abc

def

ghi

i-node-1

i-node-3

?

Cannot delete i-node before directory entry “def”

Page 7: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 8: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

8

Creating a File (1/3)

abc

ghi

i-node-1

i-node-3

Assume we want to create new file “tuv”

Page 9: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

9

Creating a File (2/3)

abc

ghi

tuv

i-node-1

i-node-3

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

Page 10: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 11: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

11

Approaches to Metadata Management

• Synchronous Writes– FFS

• Ordered Writes– Soft Updats

• Logged Writes– Journaling

Page 12: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

12

• Synchronous Writes

• Soft Updates

• Journaling– LFFS-file– LFFS-wafs

Page 13: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 14: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 15: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 16: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 17: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 18: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 19: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 20: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 21: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 22: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 23: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

23

• Properties of Metadata Operations

• Feature Comparison

• Experimental Setup & Measurements

Page 24: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 25: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

25

Feature Comparison

Page 26: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 27: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

Microbenchmark

27

Page 28: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 29: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 30: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

30

SSH Benchmark

Page 31: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

31

NetNews Benchmark

Page 32: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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

Page 33: Journaling vs Soft Updates: Asynchronous Metadata Protection in File Systems Margo I. Seltzer, Harvard, Gregory R. Ganger CMU, M. Kirk McKusick, Keith.

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.