flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonatan Most (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLINK-7347) "removeAll" is extremely inefficient in MessageAcknowledgingSourceBase.notifyCheckpointComplete
Date Wed, 02 Aug 2017 08:56:02 GMT
Yonatan Most created FLINK-7347:
-----------------------------------

             Summary: "removeAll" is extremely inefficient in MessageAcknowledgingSourceBase.notifyCheckpointComplete
                 Key: FLINK-7347
                 URL: https://issues.apache.org/jira/browse/FLINK-7347
             Project: Flink
          Issue Type: Improvement
          Components: DataStream API
    Affects Versions: 1.3.1
            Reporter: Yonatan Most


Observe this line in {{MessageAcknowledgingSourceBase.notifyCheckpointComplete}}:
{code}
idsProcessedButNotAcknowledged.removeAll(checkpoint.f1);
{code}

The implementation of {{removeAll}} is such that if the set is smaller than the collection
to remove, then the set is iterated and every item is checked for containment in the collection.
The type of {{checkpoint.f1}} here is {{ArrayList}}, so the {{contains}} action is very inefficient,
and it is performed for every item in {{idsProcessedButNotAcknowledged}}.
In our pipeline we had about 10 million events processed, and the checkpoint was stuck on
the {{removeAll}} call for hours.
A simple solution is to make {{idsForCurrentCheckpoint}} a {{HashSet}} instead of an {{ArrayList}}.
The fact that it's a list is not really used anywhere.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message