When to reach for it
- Large inputs can be split into independent chunks.
- Aggregation logic is clearly definable.
- Throughput scalability is critical.
/pattern/map-reduce/
A large task is mapped over independent chunks and subsequently aggregated or reduced into a single result.
When to reach for it
When it backfires
The tradeoff
Excellent scaling capabilities are achieved against the risk of generating inconsistent partial results.
Input is split, mapped in parallel, then reduced.
The reducer only sees per-chunk outputs and misses relationships that span chunk boundaries.
Fix · Include chunk metadata (position, overlap) in mapper output, or use a two-pass reducer that first reconciles boundaries.
One chunk is 10x larger than the others. Its mapper dominates latency and the whole job waits.
Fix · Use dynamic chunk sizing or a size-aware splitter that balances load across mappers.
Next pattern
Search patterns, frameworks, and pages.