Unit 11 of 15 · about 4 hours · explain

Distributed dataflow graphs, shuffle and operator parallelism

Both batch jobs and stream processors are graphs of operators joined by shuffles. The shuffle decides the runtime, and the hot key decides the shuffle.

You'll be able to

  • Explain a distributed dataflow graph: operators, shuffle edges, key partitioning and operator parallelism.
  • Explain why batch tasks retry transparently while stream graphs need checkpoints for the same guarantee.
  • Predict the effect of key skew on a shuffle and choose between more partitions, key splitting and pre-aggregation.

Covers

Distributed dataflow graphShuffle, partitioning and operator parallelism
1

Read

In this order, only the parts listed

0 of 3 done

  1. MapReduce, dataflow engines and shufflingDDIA 2e - Chapters 11 to 13 Batch and Stream Processing

    Chapter 11, Batch Processing Models (pp. 466 to 470): MapReduce, Dataflow Engines, Shuffling Data with hash partitioning of keys; Distributed Job Orchestration (pp. 461 to 466): task retries with atomic output publication

  2. Lab 1 MapReduce: coordinator, workers and retriesMIT 6.5840 - Lab 1 MapReduce

    The coordinator and worker task split with task retry and intermediate output files

    Read the handout for the batch-dataflow contract only. Do not confuse its shared-filesystem setup on one machine with the durable-log contract; completing the lab is optional here.

  3. Stream versus batch reviewHLD Handbook - Queues, Streaming, Stream vs Batch and CDC

    Event versus processing versus ingestion time, engines comparison, lambda versus kappa

    Review after the DDIA items. Treat its deployment figures as reported examples, not targets.

2

Focus on

  • A dataflow graph wires operators with shuffle edges: records are repartitioned by key so all records of one key reach the same downstream task.
  • The shuffle is the all-to-all bulk transfer, so partition counts and key skew decide the runtime more than per-record speed does.
  • Batch tasks retry transparently because inputs are immutable and outputs publish atomically. The visible result matches a failure-free run even though tasks recomputed.
  • Dataflow graphs are usually acyclic, so each task's input is fixed by the operators upstream of it and a failed task can recompute from that input. Cycles and arbitrary request patterns between tasks break that reasoning.
Common mistakes · 3
  • Adding reducers to fix a hot key. Every record of one key goes to one reducer, so split the key or pre-aggregate instead.
  • Confusing duplicate computation with duplicate publication. Retried tasks recompute, but atomic publication keeps one visible output.
  • Reading the shared-filesystem lab as a durability proof. Lab workers share files on one machine; a real log needs the acknowledgement contract from this section.
3

Try it yourself

Closed-book, before checking anything

Closed-book, trace a word count over two mappers and two reducers: hash-partition the keys, name what crosses the shuffle, and state which reducer a hot key overloads.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.One key carries half of all records across 100 reducers. How many reducers does it load?Answer

    One. Hash partitioning sends every record of one key to the same reducer, so the hot key overloads it regardless of reducer count.

  2. 2.A map task fails after writing half its intermediate output. What survives, and what reruns?Answer

    Nothing of its output survives; partial output is discarded. The retried task recomputes from the immutable input and publishes atomically on success.

  3. 3.What crosses the network in a shuffle, and what does not?Answer

    Intermediate records, repartitioned by key, cross to their assigned reducers. Map tasks read their input splits, ideally from local disk, and the final output is written to the distributed filesystem; neither is the shuffle.

  4. 4.One word carries 40 percent of all records in a word count. Why do more reducers not help, and what two fixes do?Answer

    Every record of one key hashes to one reducer, so that reducer still gets 40 percent of the input. A combiner pre-aggregates on the map side, so the hot reducer gets one partial count per mapper; this works because addition is associative and commutative. Key splitting appends a small salt to the hot key, spreads it over several reducers, and merges the partial counts in a second step.

5

Practice

  • AlgoMaster: Analyze MapReduce Reducer Skew

    Per-reducer load totals and the hottest reducer index from keys and weights

    A single-function skew drill on a subscription the learner owns. Full shuffle behavior is lab and mini-project work.

You're done when

You can trace keys across a shuffle by hand, name what a hot key does to it, and state why a retried batch task leaves one visible output.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 15 more in the section
  • DDIA 2e - Chapters 11 to 13 Batch and Stream ProcessingMartin Kleppmann and Chris Riccomini · primary

    Read batch processing, stream processing and the streaming-systems philosophy in order. For every guarantee, mark the source position, operator state, output effect and recovery boundary it actually covers.

  • HLD Handbook - Queues, Streaming, Stream vs Batch and CDCHLD Handbook · required

    Read only Part 2 message queues and pub-sub plus Part 4 stream versus batch and change data capture. Use Part 5 event-driven architecture after the underlying log and replay contract is clear.

  • MIT 6.5840 - Lab 1 MapReduceMIT PDOS · support

    Complete or review the coordinator and worker lab to connect deterministic batch dataflow, task retries and output publication. Do not confuse its shared-filesystem assumptions with the durable log contract.

Also in this section