You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/03/29 15:55:00 UTC

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

    [ https://issues.apache.org/jira/browse/FLINK-9107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16419233#comment-16419233 ] 

ASF GitHub Bot commented on FLINK-9107:
---------------------------------------

GitHub user NicoK opened a pull request:

    https://github.com/apache/flink/pull/5790

    [FLINK-9107][docs] document timer coalescing for ProcessFunction

    ## What is the purpose of the change
    
    In a ProcessFunction, registering timers for each event via `ctx.timerService().registerEventTimeTimer()` using timestamps 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:
    
    ```
    long coalescedTime = ((ctx.timestamp() + timeout) / 1000) * 1000;
    ctx.timerService().registerEventTimeTimer(coalescedTime);
    ```
    
    As a result, only a single timer may exist for every second since we do not add timers for timestamps that are already there.
    
    Please note that this PR includes #5788 and should also be merged into 1.3 and 1.4 docs to which it applies as well.
    
    ## Brief change log
    
    - document timer coalescing for `ProcessFunction`


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/NicoK/flink flink-9107

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/5790.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #5790
    
----
commit b6258697aabb8688aac19b5b228ddf8926e518f3
Author: Nico Kruber <ni...@...>
Date:   2018-03-29T13:55:47Z

    [FLINK-9110][docs] fix local bundler installation

commit 540485a5620f6dcdd98e751a086076fb80997f65
Author: Nico Kruber <ni...@...>
Date:   2018-03-29T13:56:23Z

    [hotfix][docs] remove duplicate bundle installation

commit f8274cf3ba06af19a4ac31e784803723e449336a
Author: Nico Kruber <ni...@...>
Date:   2018-03-29T14:20:00Z

    [FLINK-9107][docs] document timer coalescing for ProcessFunction

----


> 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.3.0, 1.4.0, 1.5.0, 1.6.0
>            Reporter: Nico Kruber
>            Assignee: Nico Kruber
>            Priority: Major
>             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)