Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-9107

Document timer coalescing for ProcessFunctions

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.0, 1.4.0, 1.5.0, 1.6.0
    • Fix Version/s: 1.4.3, 1.5.0
    • Component/s: Documentation
    • Labels:
      None

      Description

      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:

      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.

      This should be documented in the ProcessFunction docs.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                NicoK Nico Kruber
                Reporter:
                NicoK Nico Kruber
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: