1 / 45

Speculations: Speculative Execution in a Distributed File System 1 and Rethink the Sync 2

Speculations: Speculative Execution in a Distributed File System 1 and Rethink the Sync 2. Edmund Nightingale 12 , Kaushik Veeraraghavan 2 , Peter Chen 12 , Jason Flinn 12 Presentation by Ji -Yong Shin (Some slides are from Nightingale’s talk). Agenda.

lajos
Download Presentation

Speculations: Speculative Execution in a Distributed File System 1 and Rethink the Sync 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Speculations:Speculative Execution in a Distributed File System1andRethink the Sync2 Edmund Nightingale12, Kaushik Veeraraghavan2, Peter Chen12, Jason Flinn12 Presentation by Ji-Yong Shin (Some slides are from Nightingale’s talk)

  2. Agenda • CAP theorem, Consistency Semantics, Consistency Model • Papers • Speculative Execution in a Distributed File System (Award Paper from SOSP’05) • Rethink the Sync (Best Paper from OSDI’06)

  3. CAP Theorem by Eric Brewer • At most two of CAP can be satisfied simultaneously • Consistency: correctness of data • Availability: guaranteed immediate access to data • Partition Tolerance: guaranteed functioning despite network disruption or partition C N1 N2 Sync A A B A B P

  4. ACID vs BASE(Not exactly opposite but..) ACID BASE Basically Available Soft-state Eventually consistent • Atomicity • Consistency • Isolation • Duration Distributed File System Design

  5. Consistency Semantics by Leslie Lamport • Atomic (single copy) • Every read returns the value of the most recent write • Regular • Read not concurrent with any write returns the most recent write • Read concurrent with some writes returns either the most recent write or a value of concurrent write • Safe • Read not concurrent with any write returns the most recent write • Read concurrent with some writes returns any value

  6. Consistency Models • Strict consistency • All executions in strict order • Sequential consistency • All execution results exposed in strict order • Causal consistency • All executions results with causal dependency exposed in strict order • Close-to-open consistency • All execution results of processes that closed the file should be exposed to process opening the file • Delta consistency • After fixed period of time all memory parts will be consistent • Eventually consistency • After sufficiently long period of time all memory parts will be consistent

  7. Consistency and CAP theorem • Papers • Speculative Execution in a Distributed File System (Award Paper from SOSP’05) • Rethink the Sync (Best Paper from OSDI’06)

  8. Authors • Edmund B Nightingale • PhD from UMich (Jason Flinn) • Microsoft Research • Both papers are part of PhD Thesis • KaushikVeeraraghavan • PhD Student in Umich (Jason Flinn) • Peter M Chen • PhD fromUCB (David Patteron) • Faculty at UMich • Jason Flinn • PhD at CMU (MahadevSatyanarayanan) • Faculty at Umich

  9. Speculation If (a == 1) { b = 0; c = 1; } else { b = 1; c = 0; } Sync Complete • Execute using assumption • If assumption holds • performance gain • If assumption fails • Restart execution • Not much performance overhead • Example • Branch prediction • Transaction • Thread level speculation in multiprocessor (or multicore) Sync Delay Clk cycle Rollback and restart

  10. Motivation and Approach • Distributed file system • Significant cost for consistency and safety • Block and wait from sync msg and write • Tradeoff between consistency and performance • Weak consistency for high performance • Speculative distributed file system • Execute sync operations in async manner • While syncing execute next operation on cached files • Check correctness later and rollback if necessary • Guarantee single copy semantics

  11. Big Idea: Speculator Big Idea: Slow Way Client Server 1) Checkpoint RPC Req RPC Req 2) Speculate! Block! RPC Resp RPC Resp 3) Correct? No: restore process & re-execute Yes: discard ckpt. RPC Req RPC Resp

  12. Conditions for Success • Highly predictive operations • Misprediction can worsen performance • Rare misprediction • Faster checkpointing compared to remote IO • Slow checkpointing is not worth doing • 52us for small process < network IO • Available spare resource for speculation • Speculation requires memory and CPU cycles • Modern computers have abundant resource

  13. Spec Undo log Implementing Speculation 1) System call 2) Create speculation (create_speculation) Time Process Copy on write fork() Tracks kernel objects that depend on it Checkpoint Ordered list of speculative operations

  14. Spec Undo log Speculation Success 1) System call 2) Create speculation 3) Commit speculation (commit_speculation) Time Process Tracks kernel objects that depend on it Checkpoint Ordered list of speculative operations

  15. Spec Undo log Speculation Failure 2)Create speculation 1) System call 3)Fail speculation (fail_speculation) Time Process Process Tracks kernel objects that depend on it Checkpoint Ordered list of speculative operations

  16. Multi-Process Speculation • Processes often cooperate • Example: “make” forks children to compile, link, etc. • Would block if speculation limited to one task • Supports • Propagate dependencies among objects • Objects rolled back to prior states when specs fail

  17. Spec 1 Spec 1 Spec 2 Multi-Process Speculation Stat A Stat B Checkpoint Checkpoint Checkpoint Checkpoint Checkpoint pid 8000 pid 8001 Chown-1 Chown-1 Write-1 Write-1 inode 3456

  18. Ensuring Correctness • Speculative state must never be visible to • User or external device • Process not depending on the it • Controlling speculative process • Block access to external environment • Read only (getpid) and private state updates (dup2) allowed • Buffer write to external device • Propagate speculation if necessary

  19. Multi-Process Speculation • Supports • Objects in distributed file system • Will be explained in next slides • Objects in local memory file system (RAMFS) • Objects in local disk file system • Use buffering strategy for speculation • Shared on-disk metadata: only valid state committed using redo and undo • Journal: only commit non speculative operations • Etc • Pipe, fifos, unix sockets, signals, fork, exit • Doesn’t support • write-shared memory including V IPC, futex

  20. Using Speculation Client 1 cat foo(0) > bar(1) Client 2 cat bar Server foo(0), bar(0) foo(1), bar(0) foo(1), bar(1) bar(1)

  21. Using Speculation Client 1 cat foo(0) > bar(1) Client 2 cat bar Server foo(0), bar(0) foo(1), bar(0) bar(0) • Mutating Operation • Server determines speculation success/failure • State at server never speculative • Can be durable to server crash • Requires server to track failed speculations • Requires in-order processing of messages foo(0) foo(0), bar(1)

  22. Group Commit • Previously sequential ops now concurrent • Sync ops usually committed to disk • Speculator makes group commit possible Updating different files… Client Client Server Server write commit write commit Can significantly improve disk throughput

  23. Implementation • SpecNFS • Modified NFSv3 in Linux 2.4 kernel to support Speculator • Same RPCs issued (but many now asynchronous) • SpecNFS has same close-to-open consistency, safety as NFS • BlueFS • new file system for Speculator • Single copy semantics • Each file, directory, etc. has version number • Check server for every operation • Two Dell Precision 370 desktops as the client and file server • Routed packet through NISTnet network emulator to insert delay.

  24. Apache Build • With delays SpecNFSup to 14 times faster

  25. The Cost of Rollback • All files out of date SpecNFS up to 11x faster

  26. Group Commit & Sharing State

  27. Conclusion • Speculator greatly improves performance of existing distributed file systems • Speculator enables new file systems to be safe, consistent in some sense and fast

  28. Discussion • Starvation (Infinite rollback)? • Overhead for maintaining speculation? • Memory or CPU? • Multiple server environment? • Consistency? • Consistency Semantics? • Consistency Model? • CAP Theorem?

  29. CAP theorem, Consistency Semantics, Consistency Model • Papers • Speculative Execution in a Distributed File System (Award Paper from SOSP’05) • Rethink the Sync (Best Paper from OSDI’06)

  30. Synchronization Asynchronous IO Synchronous IO Low performance Blocking High reliability Resilient to crash Guaranteed ordering of IO • High performance • Non-blocking • Low reliability • Vulnerable to crash • Ordering not guaranteed External Synchrony • High performance close to async IO • Async-like execution until externalization • High reliability close to synchronous • User centric view of guaranteed durability

  31. External Synchrony • Delay commit of data until externally observable operation is necessary • Print to screen • Packet send • Externally observable behavior implicates • Operation before the observed behavior are committed

  32. Example: Synchronous I/O 101 write(buf_1); 102 write(buf_2); 103 print(“work done”); 104 foo(); Application blocks Application blocks %work done% % Disk OS Kernel TEXT Process

  33. Example: External synchrony 101 write(buf_1); 102 write(buf_2); 103 print(“work done”); 104 foo(); %work done% % Disk OS Kernel TEXT Process

  34. Improving Performance • Group commit of multiple modification • Atomic commit reduces disk access • Buffering of output • Output function runs while committing • Buffered output is released after completion of commit

  35. Multiprocess support • Necessary functions • Tracking down causal dependencies • Speculator concept borrowed • Output triggered commit • Buffering output borrowed from Speculator

  36. Commit Dep1 Multiprocess support Process 1 Process 2 101 print (“hello”); 102 read(file1); 103 print(“world”); 101 write(file1); 102 do_something(); %hello% % TEXT TEXT world Process 2 Process 2 OS Kernel Disk Process 1 Process 1

  37. Limitation • Application specific recovery is difficult • Delayed commit makes it difficult to track back • Commit may be unlimitedly delayed • 5 second rule applied, users may not meet user’s expectation • Data in multiple file system is difficult to commit in single transaction • Journal in different locations

  38. Implementation • Implemented ext sync file system Xsyncfs • Based on the ext3 file system and Speculator • Use journaling to preserve order of writes • Use write barriers to flush volatile cache • Write to disk guaranteed Speculator External Synchrony Delay commit until externalization Trace of causal dependency for commit Buffers output Group commit • Hide speculative state until RPC response • Trace of causal dependency for commit and roll back • Buffers output • Group commit

  39. Evaluation • Compare Xsyncfs to 3 other file systems • Default asynchronous ext3 • Default synchronous ext3 • Synchronous ext3 with write barriers

  40. When is data safe?

  41. Postmark benchmark • Xsyncfs within 7% of ext3 mounted asynchronously

  42. The MySQL benchmark • MySQL’s group commit can reach xsyncfs performance when # of client is large

  43. Specweb99 throughput • Xsyncfs within 8% of ext3 mounted asynchronously • Lots of operations buffered, more externalization

  44. Conclusion • New concept, external synchrony, proposed • External synchrony performs with 8% of async

  45. Discussion • What happens when external synchrony system fails? • Consistency? • Consistency Semantics? • Consistency Model? • CAP Theorem?

More Related