Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a configurable timer batch limit (
TIMER_BATCH_LIMIT
) inDoFnOp
to address memory issues observed in high-scale scenarios where multiple timers fire simultaneously. In the current implementation, all ready timers are fired in a single loop without batching, leading to excessive memory usage and out-of-memory (OOM) errors. The key changes in this PR are:Batch Timer Processing:
TIMER_BATCH_LIMIT
parameter (beam.samza.dofnop.timerBatchLimit
).doProcessWatermark
method to process timers in chunks, limiting the number of timers fired in a single loop to reduce memory spikes.Implementation Details:
Integer.MAX_VALUE
is used if no configuration is provided, maintaining current behavior for backward compatibility.TIMER_BATCH_LIMIT
timers. After each batch, outputs are emitted and memory is cleared.Code Changes:
TIMER_BATCH_LIMIT_CONFIG
for configurable timer batch limits.doProcessWatermark
to iterate over timers in chunks, respecting the batch limit.Addresses
This PR addresses memory issues caused by the unbounded accumulation of timer outputs during high-scale workloads in
DoFnOp
.Testing