tldr: Naiad
Part of the tldr series, which summarizes papers I'm currently reading. Inspired by the morning paper.
Naiad: A Timely Dataflow System [2013]
Murray et. al
Introduction
Naiad is a distributed system for big data computation. It's motivated by computing on real-time streaming, incremental data. (In contrast, Spark handles iterative data that's reused but unchanged, so Spark would have to start over if new data is added.) Naiad's goal is to get high performance through parallelism.
Timely Dataflow
Naiad is based on a new computing model that the authors call timely dataflow. It's a directed graph with stateful vertices that send and receive messages along the edges. Furthermore, there are input vertices which receive a sequence of messages from an external producer, and output vertices, which send a sequence of messages to an external consumer. Finally, there may be nested cycles, called loop contexts. The figure below shows an example of a simple dataflow graph:
The external producer that sends messages to the input vertex labels each message with an epoch. Specifically, each message looks like:
The epoch defines which interval of time the message belongs to, and the k loop counters keep track of the k loop contexts an edge is in. There are three kinds of vertices in a loop context:
- Ingress vertex. In the figure above, vertex "I". Push a loop counter c into the array of loop counters.
- Feedback vertex. In the figure above, vertex "F". Sets c to c+1 in the corresponding loop counter.
- Egress vertex. In the figure above, vertex "E". Pops a loop counter c from the array of loop counters.
Vertex Programming Model
The API for handling vertices is:
- this.NotifyAt(t: Timestamp)
- Notify the app when at a specific timestamp
- Calling this results in a corresponding invocation of v.OnNotify(t)
- this.SendBy(e: Edge, m: Message, t: Timestamp)
- Send a message at a current or future timestamp
- Calling this results in a corresponding invocation of v.OnRecv(e, m, t)
- Callback: v.OnNotify(t: Timestamp)
- There are no more messages with timestamp <= t that will be sent to this vertex
- Callback: v.OnRecv(e: Edge, m: Message, t: Timestamp)
- Vertex is notified of message
Although this low-level programming is complicated, most developers don't work with timely dataflows and timestamps.
Conclusion
Naiad has impressive performance on PageRank, and performs well on applications with iterative batching, graph processing, and iterative ML.