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

Improve efficiency of iterating KeySelectionListener on notification

    XMLWordPrintableJSON

Details

    Description

      KeySelectionListener was introduced for incremental TTL state cleanup as a driver of the cleanup process. Listeners are notified whenever the current key in the backend is set (i.e. for every event). The current implementation of the collection that holds the listener is a HashSet, iterated via `forEach` on each key change. This method comes with the overhead of creating temporaray objects, e.g. iterators, on every invocation and even if there is no listener registered. We should rather use an ArrayList with for-loop iteration in this hot code path to i) minimize overhead and ii) minimize costs for the very likely case that there is no listener at all.

      Attachments

        Issue Links

          Activity

            People

              srichter Stefan Richter
              srichter Stefan Richter
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m