Batching to Share Fixed Overhead
A batch can combine many operations into fewer requests or writes. It can also change memory use, wait time, and recovery scope.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace an arithmetic model
If each request costs five units of setup and one per record, ten single requests cost sixty. One ten-record request costs fifteen. Fixed-size batching describes how to handle partial groups.
Check the new boundaries
A stream waiting to fill a batch may delay its first record. Store those effects in the operation's requirements. Batch-level commits show a persistence tradeoff.[1]
Calculate per-item cost in a fixed-plus-variable model
Suppose processing a request costs three milliseconds of setup and one per item. Five individual requests cost twenty milliseconds. One batch of five costs eight under the same serial model. The model does not include wait time to fill the batch. See fixed-size batches.
5 × (3 + 1) = 20 ms
One batch: 3 + 5 × 1 = 8 ms
Setup saved: 12 ms
Bound the delay and partial-failure behavior
Batching can delay the earliest item while gathering later ones. A failed batch may need per-item outcomes. Test modest bursts, empty input and a final underfilled batch.