Beyond MapReduce: Dataflow Engines
How Spark, Tez and Flink run a whole pipeline as one graph of operators instead of a chain of MapReduce jobs, how they recover from failure, and how to choose between them.
Overview
Why MapReduce was not enough
A real batch pipeline is rarely one map and one reduce. Cleaning logs, joining them with users, aggregating by day and ranking the results might take five MapReduce jobs chained together. Each job writes its full output to the replicated distributed file system, and the next job cannot start until the previous one has finished and read it all back.
That costs time three ways: every intermediate result is written and replicated even though it is thrown away soon after; a job waits for every task of the job before it; and a mapper that only reads a file and passes it on still has to run. Algorithms that loop over the same data, such as machine learning training or PageRank, pay this on every pass.
Key concepts
- Dataflow engine
- DAG
- Stage (Spark)
- Narrow and wide dependency
- Lineage
- Lazy evaluation
- Bounded stream
- Broadcast join
- Micro-batch
Interview questions
- When would you use Flink instead of Spark?
- How does Spark recover from a failed machine without writing every intermediate result to disk?
- A Spark job with a big join is slow. What do you look for?
Sign up free to read the full topic
More DDIA topics
- ACID Properties
- B-Trees and Write-Ahead Logs
- Change Data Capture (CDC)
- Clocks and Time in Distributed Systems
- Column-Oriented Storage and Compression
- Consensus Algorithms: Paxos and Raft
- Consistency Guarantees: Eventual, Causal and Linearizable
- Declarative vs Imperative Query Languages
- Encoding Formats: JSON, Protobuf, Avro, Thrift
- End-to-End Correctness and the Exactly-Once Myth
- Event Streams and Message Brokers
- Fan-Out and the Twitter Timeline Problem
Start free on Cariara · Coding problems · System design studio