Pattern · seen in 1 breakdown across 1 company
Batched Routing by Destination
Definition
Batched routing by destination is a strategy for issuing bulk operations against partitioned downstream systems without paying the fanout cost of cross-partition batches. Incoming items arrive in an interleaved stream (orders by region, log lines by service, messages by tenant); a routing layer groups items by their downstream destination (database shard, search cluster, partition, node) and issues each bulk operation against a single destination. The result: each bulk operation has a narrow fault domain, single-destination failures no longer cause widespread batch failures, and the downstream system can apply per-destination optimizations.
The failure mode the pattern addresses is fanout amplification of single-point failures. When a bulk operation contains items destined for many backend nodes — say, 50 messages going to 50 different shards — the operation as a whole is considered failed if any single destination fails. A single failed node causes a disproportionate fraction of bulk operations to fail. With 100 evenly-distributed destinations and 50-item batches, a single-node failure causes roughly 40% of bulk operations to fail (the math is approximately 1 - (99/100)^50). The failure mode scales badly: more destinations make it worse, not better.
The fix is to require each bulk operation to target exactly one destination. The routing layer reads the stream, examines each item's destination key, and dispatches the item to a per-destination collector. Each collector accumulates items until it has enough to issue a useful bulk operation (or until a timeout fires), then sends the batch to that destination only. Single-destination failures now affect only their own batches; multi-destination failures still exist but are bounded by the destinations affected, not by the cross-product of destinations in any batch.
The implementation pattern is straightforward in any language with first-class concurrency primitives: a dispatcher reads the stream, a per-key task pool collects items into batches, and timeouts force batches to flush even when not full. Discord's 2025 implementation uses Rust tokio tasks with one task per cluster+index destination. The same shape appears in many systems: Kafka producers batching by partition, database connection pooling with per-shard batches, log aggregators batching by destination index.
When it applies
Tradeoffs
The same move, 1 ways
Every row is a production system that bet on this pattern — the note says how, in that system's own terms.
Problems this pattern answers
The walls where its breakdowns live — each opens the cross-company comparison.