Lab · Architecture patterns
Batch jobs: map, shuffle, reduce
A job counts clicks per country across 8 input files. Mappers read the files, the shuffle sends each country to one reducer, and reducers add up the totals. Add a combiner, make one country hot, or slow one worker, and watch the job time.
Try it
- Input files — 8 files of 400 — healthy
- Mappers — 0 of 4 busy — healthy — 8 of 8 mapped
- Shuffle — every record — healthy
- Reducers — 4 reducers — healthy — reducing
- Counts — per country — healthy
- A file read by a mapper
- Map output, or the final counts
- Records shuffled to a reducer
Phase
Shuffle and reduce
job 1
Last job time
—
Records shuffled
—
in the last job
Busiest reducer
—
of the records shuffled
Backup tasks
—
in the last job
Numbers add up:8 map task copies = 8 finished + 0 killed + 0 running; every job's counts add up to 3200The lab checks this sum as it runs, so a counting mistake would show here.
Controls
Reducers (this job)
| Reducer | Countries | Records received | Status |
|---|---|---|---|
| 1 | GB, ID, MX | 692 | done |
| 2 | BD, BR, NG, US | 939 | reducing |
| 3 | DE, IN, JP | 1145 | reducing |
| 4 | FR, PK | 424 | done |
Recent jobs
| Job | Time | Map phase | Shuffled | Busiest reducer | Settings |
|---|
What just happened
- 0.0sInfo: Job 1 starts: 8 splits on 4 mappers, 4 reducers.
What this model simplifies
- Time is slowed so you can watch each task. A map task here reads 400 records in 0.8 s; real jobs read gigabytes per task.
- Reduce starts only when every map task is done. Real frameworks start fetching map output early, but still cannot finish a reducer before the last map task.
- A backup copy is only considered when a mapper becomes free. Real schedulers check running tasks on a timer.
- Workers never crash here. A real framework reruns a failed task elsewhere, which is why map and reduce steps must be safe to repeat.