[jira] [Created] (FLINK-11980) Improve efficiency of iterating KeySelectionListener on notification

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

[jira] [Created] (FLINK-11980) Improve efficiency of iterating KeySelectionListener on notification

Shang Yuanchun (Jira)
Stefan Richter created FLINK-11980:
--------------------------------------

             Summary: Improve efficiency of iterating KeySelectionListener on notification
                 Key: FLINK-11980
                 URL: https://issues.apache.org/jira/browse/FLINK-11980
             Project: Flink
          Issue Type: Improvement
          Components: Runtime / State Backends
    Affects Versions: 1.8.0
            Reporter: Stefan Richter
            Assignee: Stefan Richter


{{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.



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