Hi to all,
I was writing a process function similar to the one described in the Flink
docs at [1].
Basically I need to set a timeout before emitting elements.
However, the proposed approach creates a timer for every incoming
tuple..isn't it dangerous if a key receives a very big burst of events?
You'll end up having tons of useless registered timers that will fill
somehow the memory.
Isn't it better to remove obsolete timers? E.g:

CountWithTimestamp current = state.value();
if (current == null) {
     current = new CountWithTimestamp();
     current.key = value.f0;
 } else {
    ctx.timerService().deleteProcessingTimeTimer(current.lastModified +
timeout);
 }

Best,
Flavio

[1]
https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/process_function.html

Reply via email to