Jiayi Liao created FLINK-23690:
----------------------------------
Summary: Processing timers can be triggered more efficiently
Key: FLINK-23690
URL: https://issues.apache.org/jira/browse/FLINK-23690
Project: Flink
Issue Type: Improvement
Components: Runtime / Task
Affects Versions: 1.13.2, 1.12.5, 1.11.4, 1.14.0
Reporter: Jiayi Liao
After FLINK-23208, the processing timers are triggered more efficiently but it
can still be improved. (The performance can be tested with
[benchmark|https://github.com/apache/flink-benchmarks/blob/master/src/main/java/org/apache/flink/benchmark/ProcessingTimerBenchmark.java])
Currently {{InternalTimerService.onProcessingTime(long)}} polls a timer from
{{processingTimeTimersQueue}} and register a new timer after the polled timer
is triggered, which means timers with different timestamps will be registered
for multiple times. This can be improved with codes below:
{code:java}
long now = System.currentTimeMillis() - 1
while ((timer = processingTimeTimersQueue.peek()) != null &&
timer.getTimestamp() <= now) {
processingTimeTimersQueue.poll();
keyContext.setCurrentKey(timer.getKey());
triggerTarget.onProcessingTime(timer);
}
{code}
But due to the bug described in FLINK-23689, this change has conflicts with
current implementation of {{TestProcessingTimeService.setCurrentTime(long)}},
which causes a lot of tests to fail(e.g. InternalTimerServiceImplTest).
Therefore, before working on this improvement, FLINK-23689 should be fixed
firstly.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)