[jira] [Created] (FLINK-9107) Document timer coalescing for ProcessFunctions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-9107) Document timer coalescing for ProcessFunctions

Shang Yuanchun (Jira)
Nico Kruber created FLINK-9107:
----------------------------------

             Summary: Document timer coalescing for ProcessFunctions
                 Key: FLINK-9107
                 URL: https://issues.apache.org/jira/browse/FLINK-9107
             Project: Flink
          Issue Type: Improvement
          Components: Documentation, Streaming
    Affects Versions: 1.4.0, 1.3.0, 1.5.0, 1.6.0
            Reporter: Nico Kruber
            Assignee: Nico Kruber
             Fix For: 1.5.0, 1.4.3, 1.3.4


In a {{ProcessFunction}}, registering timers for each event via {{ctx.timerService().registerEventTimeTimer()}} using times like {{ctx.timestamp() + timeout}} will get a millisecond accuracy and may thus create one timer per millisecond which may lead to some overhead in the {{TimerService}}.

This problem can be mitigated by using timer coalescing if the desired accuracy of the timer can be larger than 1ms. A timer firing at full seconds only, for example, can be realised like this:

{code}
coalescedTime = ((ctx.timestamp() + timeout) / 1000) * 1000;
ctx.timerService().registerEventTimeTimer(coalescedTime);
{code}

As a result, only a single timer may exist for every second since we do not add timers for timestamps that are already there.

This should be documented in the {{ProcessFunction}} docs.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)