Package org.apache.beam.sdk.transforms
Class BatchElements.BatchConfig.Builder
java.lang.Object
org.apache.beam.sdk.transforms.BatchElements.BatchConfig.Builder
- Enclosing class:
BatchElements.BatchConfig
-
Method Summary
Modifier and TypeMethodDescriptionbuild()withMaxBatchSize(int maxBatchSize) Sets the maximum batch size.withMinBatchSize(int minBatchSize) Sets the minimum batch size.withTargetBatchDurationSecs(double targetBatchDurationSecs) Sets the target batch duration excluding fixed cost.withTargetBatchDurationSecsWithFixedCost(double value) Sets the target batch duration including fixed cost.withTargetBatchOverhead(double targetBatchOverhead) Sets the target batch overhead ratio.withVariance(double variance) Sets the allowed variance when selecting batch sizes.
-
Method Details
-
withMinBatchSize
Sets the minimum batch size.- Parameters:
minBatchSize- minimum number of elements per batch
-
withMaxBatchSize
Sets the maximum batch size.- Parameters:
maxBatchSize- maximum number of elements per batch
-
withTargetBatchOverhead
Sets the target batch overhead ratio.This represents the desired ratio:
fixed_cost / total_time
Lower values favor larger batches (higher throughput, higher latency).
- Parameters:
targetBatchOverhead- value in (0, 1]
-
withTargetBatchDurationSecs
public BatchElements.BatchConfig.Builder withTargetBatchDurationSecs(double targetBatchDurationSecs) Sets the target batch duration excluding fixed cost.This controls the desired time spent processing elements in a batch, ignoring fixed overhead.
- Parameters:
targetBatchDurationSecs- target duration in seconds
-
withTargetBatchDurationSecsWithFixedCost
Sets the target batch duration including fixed cost.If set, this provides a stricter upper bound on total batch processing time.
- Parameters:
value- target duration in seconds
-
withVariance
Sets the allowed variance when selecting batch sizes.This introduces controlled randomness to avoid converging to a single batch size and improves robustness of estimation.
- Parameters:
variance- relative deviation (e.g., 0.25 for ±25%)
-
build
-