IntermediateAbout 15 min

    MapReduce & Batch Processing

    Read the full article on Substack

    7 min read.

    Run a word count and a join across mappers and reducers, watch the shuffle group keys, and see a failed task retried without changing the result.

    Think of it this way: Counting votes in a national election: every polling station tallies its own ballots (map), the tallies for each candidate are sent to one counting office (shuffle), and that office adds them up (reduce). If one station loses its count, it recounts its own box; nobody else starts over.

    Map
    M1Chunk 1waiting

    the cat sat

    M2Chunk 2waiting

    the dog ran

    M3Chunk 3waiting

    a cat ran

    shuffle by hash(key), then sort
    Reduce
    R1waiting
    R2waiting

    Count words in a file too big for one machine. It is split into 3 chunks, one per mapper.

    1/10

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Run a word count

    Sequence

    Order the stages of a MapReduce word count, from raw file to output.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    6. 6Drop a step here
    6 pieces left to place

    Quiz

    8 questions
    Question 1 of 8
    Score: 0

    What does a mapper emit?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going