#[non_exhaustive]pub enum BatchingPolicy {
Immediate,
Size,
Duration(Duration, OnFull),
}Expand description
A policy controlling when batches get processed.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Immediate
Immediately process the batch if possible.
When concurrency and resources are available, new items will be processed immediately (with a batch size of one).
When resources are not immediately available, then the batch will remain open while acquiring resources to allow more items to be added, up to the maximum batch size.
In this way, we try to prioritise larger batch sizes, while still keeping latency low.
When concurrency is maximised, new items will added to the next batch (up to the maximum batch size). As soon as a batch finishes the next batch will start. When concurrency is limited to 1, it will run batches serially.
Prioritises low latency.
Size
Process the batch when it reaches the maximum size.
Prioritises high batch utilisation.
Duration(Duration, OnFull)
Process the batch a given duration after it was created.
If using OnFull::Process, then process the batch when either the duration elapses or the
batch becomes full, whichever happens first.
Prioritises regularity.