Scatter-Gather
Scatter-gather broadcasts a request to parallel handlers and aggregates their responses — with a deadline that decides whether late answers count, and quorum rules for incomplete sets.
Definition
Scatter-gather fans a request out to multiple targets — replicas, shards, or service variants — and combines the results. The design decisions are the deadline (returning partial results when it expires), the aggregation (first-wins, merge, majority vote), and the failure policy (which incompleteness is acceptable per use case). It is the pattern behind hedged requests, parallel shard queries, and ensemble inference.
Context and scope
Applied in search across shards, price aggregation across providers, redundant computation for reliability, and ML ensemble serving.
Common misconceptions
- Scatter-gather means broadcasting everything — scatter selectively; targets that cannot contribute are pure latency and load
- The deadline is optional — without it, the aggregate completes at the slowest target, recreating the tail problem the pattern often exists to solve
- All responses are required — most uses define a usable subset: quorum reads, top-k of responses, first-wins races
Anti-patterns
- Waiting for every straggler and shipping the slowest-of-N latency the fan-out was meant to beat
- Aggregating without deduplication when targets overlap and double-counting contributions
- Ignoring failed shards silently and returning results that look complete but cover a fraction of the data
Related concepts
Authoritative source
https://www.enterpriseintegrationpatterns.com/patterns/messaging/BroadcastAggregate.html
What it is
Some answers are inherently parallel: ask several sources, combine them. Scatter-gather names the full lifecycle — fan out, await with deadline, aggregate by rule, handle incompleteness honestly.
How it works
The dispatcher sends to targets in parallel and collects futures. The deadline fires the aggregation with whatever arrived. Aggregators range from trivial — first response wins — to semantic — merging ranked lists, majority-voting classifications, summing partial counts with explicit coverage accounting.
When to use it
Latency-bounded aggregation over independent sources: shard queries, multi-provider lookups, redundancy against stragglers. Reserve synchronous-parallel scatter-gather for request paths; batch analytics usually prefers streaming joins.
Pitfalls
Coverage lies: returning results without saying which targets contributed misleads downstream logic — attach completeness metadata. Fan-out amplifies load: scattering to N targets on every request multiplies QPS; cache or sample where business value allows. Cancellation on deadline must propagate, or targets keep computing for dropped requests.