MapReduce processes a large dataset by partitioning it into smaller chunks, mapping each chunk to a partial result, then reducing those results into one answer. Parallel map operations can speed up sufficiently large CPU-bound workloads. section 6.4
A practical MapReduce workflow:
- Partition the input into manageable chunks, such as individual lines of text. section 6.4.1
- Map each chunk to a partial result, such as a dictionary of word frequencies. section 6.4.1
- Reduce partial results by merging matching keys and combining their counts. section 6.4.1
- Run independent map operations with multiprocessing and asyncio when the workload is CPU-bound. section 6.0
Counting words
For four text lines, mapping produces one frequency dictionary per line. Reducing merges those dictionaries into totals such as “I”: 5, “know”: 6, and “much”: 2. section 6.4.1
Figure 6.1 A large set of data is split into partitions, then a map function produces intermediate results. These intermediate results are combined into a result.
Visualizes partitions flowing through a map function into intermediate results and a combined result. section 6.4





