Rethink the Sync! Rethink the Sync! Edmund B. Nightingale Kaushik Veeraraghavan Peter M. Chen Jason Flinn University of Michigan
Sync or Async Async? ? Sync or • Desktop file systems typically use asynchronous I/O • Advantages of synchronous file I/O: – Cleaner abstraction – Any output seen by user is durable – Application programming is easier • Disadvantage of synchronous file I/O: Slow! • Need new model: visible synchrony Rethink the Sync!
Visible Synchrony Visible Synchrony • Synchronous file operation guarantees: – Ordering: if A happens before B, effects of B not visible unless the effects of A also visible. – Durability: any operation that is observed to complete is already committed to disk. • Current OSes provide guarantees to applications. – Do not return from system call until data committed. Idea: provide guarantees to external observers instead! Rethink the Sync!
Ordering and Durability Ordering and Durability • Ordering: commit operations in temporal order – Use ext3 in data journaling mode. • Durability: – File system operations return immediately but taint process. – OS buffers (uncommitted) output from tainted processes. – When data commits, OS removes taint, releases output. – OS tracks taint spread through IPC, shared memory, etc. Rethink the Sync!
Synchronous I/O Synchronous I/O Application OS Write A Commit A Write B Commit B Output: “wrote B” Slow! Many synchronous disk writes Rethink the Sync!
Visibly Synchronous I/O Visibly Synchronous I/O Application OS Write A Commit A Buffer until Write B committed Commit B Output: “Wrote B” Much faster (with a few more tricks) Rethink the Sync!
Results: Linux 2.4 kernel Results: Linux 2.4 kernel Async Sync Sync Visible (default) (barriers) Synchrony Durable? No Not power loss Yes Yes after fsync? No Not power loss Yes Yes Apache Build 1:46 2:20 21:27 1:50 (overhead) --- (59%) 12x (4%) PostMark 8.1 s. 132 s. 1661 s. 8.8 s. (overhead) --- 16x 204x (8%) Visible synchrony: durability with low overhead! Users see behavior equivalent to synchronous I/O No application modification required. Rethink the Sync!
Latency vs. Throughput Latency vs. Throughput Application OS Don’t commit yet! User not waiting Write A For output Buffer until Group commit when Write B committed output buffered Commit A+B Output: “Wrote B” Idea: Optimize for latency or throughput based upon visibility. Rethink the Sync!
Recommend
More recommend