DDOS: Taming Nondeterminism in Distributed Systems
Total Page:16
File Type:pdf, Size:1020Kb
DDOS: Taming Nondeterminism in Distributed Systems Nicholas Hunt, Tom Bergan, Luis Ceze, Steven D. Gribble Computer Science and Engineering, University of Washington nhunt,tbergan,luisceze,gribble @cs.washington.edu { } Abstract but the network connecting the nodes is also a major contributor: Nondeterminism complicates the development and management of arbitrary messages can be lost or reordered. Without mechanisms distributed systems, and arises from two main sources: the local to control both sources, it is exceptionally challenging to replicate behavior of each individual node as well as the behavior of the distributed systems and to reproduce buggy distributed executions. network connecting them. Taming nondeterminism effectively re- There are two main approaches to handling nondeterminism. quires dealing with both sources. The first is to record and later replay the nondeterminism, sim- This paper proposes DDOS, a system that leverages prior plifying debugging by making executions repeatable. The second work on deterministic multithreading to offer: 1) space-efficient approach eliminates nondeterminism altogether by executing the record/replay of distributed systems; and 2) fully deterministic dis- program deterministically with respect to its explicitly specified in- tributed behavior. Leveraging deterministic behavior at each node puts. This approach simplifies both debugging and fault-tolerant makes outgoing messages strictly a function of explicit inputs. replication. This allows us to record the system by logging just message’s This paper describes DDOS, a system we built to explore the arrival time, not the contents. Going further, we propose and im- trade-offs between record/replay and determinism in distributed plement an algorithm that makes all communication between nodes systems. In record/replay mode, DDOS generates space-efficient deterministic by scheduling communication onto a global logical replay logs that can be used to replay an entire distributed system. timeline. In deterministic execution mode, the entire distributed system is We implement both algorithms in a system called DDOS executed deterministically with respect to inputs from outside the and evaluate our system with parallel scientific applications, an distributed system, such as external network packets and user input. HTTP/memcached system and a distributed microbenchmark with To our knowledge, this is the first proposal for fully deterministic a high volume of peer-to-peer communication. Our results show execution of arbitrary distributed systems. up to two orders of magnitude reduction in log size of record/re- Both implementations exploit local-node determinism as pro- play, and that distributed systems can be made deterministic with vided by prior work in dOS [4]. For record/replay, we observe an order of magnitude of overhead. that given local-node determinism, it is sufficient to record just the arrival time of internal node-to-node messages, and not the mes- Categories and Subject Descriptors C.2.4 [Computer Commu- sage’s contents; local determinism guarantees that message con- nication Networks]: Network Protocols and Distributed Systems; tents will be regenerated deterministically during replay. For dis- D.4.1 [Operating Systems]: Process Management; D.4.5 [Operat- tributed determinism, we propose an algorithm for delivering in- ing Systems]: Reliability ternal node-to-node messages deterministically. When combined with local-node determinism, this algorithm guarantees determin- Keywords Distributed Systems, Reliability, Determinism, Record- and-Replay istic distributed execution. DDOS advances prior work in two ways. First, existing record/re- play systems [10, 14, 18] often produce prohibitively large logs 1. Introduction (multiple gigabytes per hour) because they work at the boundary Nondeterminism makes the development of distributed systems dif- of each local-node and thus need to record the contents and deliv- ficult. Without the ability to precisely reproduce a buggy execution, ery times of internal network messages. DDOS generates space- it is challenging for developers of distributed applications to track efficient logs by exploiting local-node determinism to eliminate down the root cause of a bug. Further, replicating distributed sys- the need to log the contents of internal messages. DDOS leverages tems for fault tolerance is hard since nondeterminism can cause the observations similar to those made by DejaVu [18], but because replicas’ executions to diverge. Ideally, the behavior of distributed DejaVu is a full record/replay system, it is not able to achieve the systems would be solely a function of well-defined inputs. considerable log size reductions that DDOS achieves by exploiting However, nondeterminism is pervasive in distributed systems. local-node determinism. Not only does each individual node encounter nondeterminism lo- Second, existing deterministic execution systems have focused cally due to timing variations in the operating system and hardware, on multithreaded programs. These systems either support single- node determinism only [4, 5, 8] or support distributed systems with a limited communication model [1]. As part of DDOS, we pro- pose and implement an algorithm to make inter-node communica- Permission to make digital or hard copies of all or part of this work for personal or tion fully deterministic and for arbitrary applications and commu- classroom use is granted without fee provided that copies are not made or distributed nication patterns. for profit or commercial advantage and that copies bear this notice and the full citation Our DDOS implementation supports arbitrary distributed POSIX- on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. compatible applications—including applications with data races— ASPLOS’13, March 16–20, 2013, Houston, Texas, USA. without requiring changes to application binaries. Our evaluation Copyright c 2013 ACM 978-1-4503-1870-9/13/03. $15.00 shows that our record/replay mechanism can reduce the required log sizes by up to 70%, and that our deterministic execution mode DPG socket imposes up to an order of magnitude overhead relative to nonde- Pa terministic execution—these overheads vary wildly with frequency memory Thread 1 and pattern of communication. page shim Thread Finally, our evaluation demonstrates the following trade-off be- 2 tween record/replay and deterministic execution: the record/replay clock pipe mechanisms in DDOS impose a lower performance overhead at the Thread 3 expense of larger logs, whereas the deterministic execution mech- Pb anisms lessens the space requirements for logs at the expense of performance. Figure 1. A Deterministic Process Group (from [4]) 1.1 Use Cases for Distributed Replay Debugging. Debugging distributed systems is a daunting task. In addition to tracking down bugs that occur locally within a single 2.1 Deterministic Process Groups node of the system, bugs in distributed systems can be dependent A DPG is an abstraction that allows a group of multithreaded pro- on deep communication chains involving a large number of nodes cesses to execute deterministically on a single node. Specifically, across the network. Local-node record/replay can help with the DPGs provide a mechanism to partition the sources of nondeter- first class of bugs, but requires logging all communication between minism that can affect a process into internal sources and external nodes, which can be prohibitive for some applications. Further, sources: internal sources of nondeterminism are eliminated from local-node record/replay does little to help find bugs of the second DPGs, but external sources of nondeterminism are fundamentally class because the root causes of these bugs are visible only when the nondeterministic and cannot be eliminated. Examples of internal entire distributed system is replayed as a unit. The space-efficient, sources of nondeterminism include thread scheduling, hardware full-system record/replay mode provided by DDOS makes this timing variations, and communication between threads involving debugging technique more practical. pipes, shared-memory, local files, and so on. External sources of nondeterminism include reading physical clocks and communicat- 1.2 Use Cases for Distributed Determinism ing with processes outside of a DPG. Debugging. Determinism helps with debugging by making execu- Additionally, dOS defines a shim layer API that allowed pro- tion repeatable. For debugging, main difference between determin- grammers to interpose on all external nondeterminism. Any time a ism and record/replay is that a deterministic system enforces a par- DPG receives input from a nondeterministic external source, dOS ticular communication schedule between nodes, obviating the need funnels that event through the shim layer, allowing the shim pro- to actually log this communication. The user can observe buggy grammer to control how that nondeterminism is introduced. For behavior again by simply re-running the application with the same example, a shim may implement the record half of a record/replay inputs. mechanism by creating a log entry on every nondeterministic event. Replication. A second application for distributed determinism Figure 1 shows an example of a DPG containing two processes is to enable replication of an entire distributed system for fault- and three threads communicating with each other using shared- tolerance. By instantiating multiple copies of