Skip to main content
NewEpisode 3a is out: Carry the conversation onWatch →

This part is for members

Membership opens soon. Leave your email and we'll tell you the day it does. Founding members get the launch price.

Keep watching the free parts
MapReduce · Lab 1 · 2

The MapReduce Model: Map, Partition, Reduce

Follow one word, "of", along Lab 1's data path. mrsequential's own comment admits that real MapReduce partitions the intermediate data into NxM buckets. M = 8 (one map task per book) and R = 10 (the nReduce hard-coded in mrcoordinator.go), so there are 8 × 10 = 80 intermediate files, mr-X-Y. Bucketing by first letter fails (2,691 distinct words start with s, 12 with z); worker.go's ihash is FNV-1a, and "of" by hand gives 1,765,031,016 → bucket 6. The same word goes to the same column from every row, so reduce 6 reads mr-0-6 to mr-7-6, sorts, groups, reduces and writes of 13536. In the real run, distinct words per bucket are even (2,173–2,251) but pairs range from 39,508 to 105,743: a hash balances keys, not work. TestWc compares the merged, sorted output with mrsequential's byte for byte, and reduce must wait for every map. Your turn: hash "the" by hand, where the mask matters.