KatInterview

Designing a Distributed MapReduce Data Pipeline

System DesignModel answer
HardModel answerSystem Designsystem-designdistributed-systemsmapreduce

Last updated

Design a large-scale MapReduce batch execution platform covering task scheduling, shuffle optimization, data skew mitigation, fault recovery, and commit semantics.

Design a distributed batch processing framework operating on MapReduce principles to process large datasets (e.g., 100+ TB of raw inputs) efficiently and reliably.

Your design should cover:

  1. Core Workload & Target Scale: Frame concrete constraints around data volume, cluster hardware, latency goals, and semantic guarantees.
  2. Schemas & Interface: Define input/output specifications, intermediate records, and task execution interfaces.
  3. Architecture & Task Lifecycle: Detail coordinator responsibilities, worker processes, execution state management, and the data pipeline topology.
  4. Partitioning & Shuffle Efficiency: Address how parallel execution occurs, how data moves across the network, and strategies to minimize bandwidth (e.g., locality, combiners, push vs. pull shuffle, compression).
  5. Handling Skew & Tail Latencies: Provide mechanisms to handle disproportionate key distributions and slow nodes.
  6. Fault Tolerance & Semantics: Detail node failure handling, speculative execution, poison pill isolation, and how to guarantee end-to-end exactly-once processing on non-transactional underlying stores.

Hints

Hint 1

Break down the data flow into clear stages: Input Read -> Map -> In-Memory Sort/Spill -> Shuffle -> Reduce Merge -> Atomic Commit.

Hint 2

Focus on the network bottleneck: how combiners, serialization formats, local disk caching, and push-based shuffle reduce cross-rack bandwidth.

Hint 3

Address key skew and stragglers separately: skew requires structural changes (salting, adaptive re-partitioning), while stragglers require execution-level mitigations (speculative tasks).