Distributed Processing and Map-Reduce

Context: FIT1043_MOC Β· break computation up to scale past one machine Β· the paradigm behind Spark Β· processes Big Data

Quick Revision

  • 🎯 Objective: scale computation by splitting it across machines βž” Map-Reduce = data-parallel map then a reduce (merge).
  • πŸ“¦ Core Components: processing modes (interactive / streaming / batch) | data-parallel map | key-based reduce.
  • ⚑ Key Constraint: it only works when the work is data-parallel β€” independent chunks that can be processed separately, then merged.

πŸ“ How It Works

1. Processing Modes

  • Interactive βž” humans in the loop.
  • Streaming βž” massive data flows through the system with little storage (real-time).
  • Batch βž” data stored, analysed in large blocks (β€œbatches”) β€” easier to develop/analyse (offline).

2. Background Concepts

  • In-memory βž” in RAM, not going to disk (fast, volatile); vs HDD/SSD (permanent).
  • Parallel processing βž” tasks run at the same time; distributed computing βž” across multiple machines.
  • Scalability βž” handle growing work by enlarging capacity (not just β€œbig”).
  • Data-parallel βž” processing done independently on separate chunks of data β€” the prerequisite for Map-Reduce.
  • Legacy limit βž” desktop tools (SAS/R/Matlab) often lack distributed support; distributing needs algorithm redesign.

3. Map-Reduce

  • Origin βž” a simple distributed framework from Google (Dean & Ghemawat, 2004); runs on commodity hardware with fault tolerance.
  • Pattern βž” (1) divide data across machines β†’ (2) map() each record to key-value pairs β†’ (3) sort/merge identical keys β†’ (4) reduce (merge) per key.
  • History βž” Google moved on (~2005) to β€œCloud Dataflow”; the idea lives on in Hadoop/Spark.

πŸ“Š Exam Execution Trace

Manual Execution Trace β€” word count

Step / StateActionResult
0 (Init)split text across nodesshards on machines
1 (map)each word β†’ (word, 1)("the",1) ("cat",1) ("the",1)
2 (sort/shuffle)group by key("the",[1,1]) ("cat",[1])
3 (reduce)sum values per key("the",2) ("cat",1)

Final Extracted Output: per-word counts, computed data-parallel then merged β€” scales to huge corpora on commodity machines.

When It Flips: streaming vs batch is the axis behind Hadoop and Spark β€” Netflix's pipeline handles ~500 billion events / 1.3 PB per day (β‰ˆ8M events/sec at peak) by streaming (Kafka + Spark), not overnight batch.

🧠 Active Recall