ActiveMQ checkpoint worker makes unnecessary repeated calls to
Journal.getFileMap(), leading to excessive memory usage
----------------------------------------------------------------------------------------------------------------------
Key: AMQ-3162
URL: https://issues.apache.org/jira/browse/AMQ-3162
Project: ActiveMQ
Issue Type: Bug
Affects Versions: 5.4.2
Reporter: Craig Condit
Priority: Minor
During its cleanup run (default every 30 seconds),
MessageDatabase.checkpointUpdate() attempts to determine which data files are
safe to delete. It calls Journal.getFileMap() repeatedly within a loop to
determine if the file is referenced in memory. Journal.getFileMap() creates a
new TreeMap from the underlying map. Unfortunately, as the number of data files
grows on a busy broker, this can be called hundreds or even thousands of times,
leading to excessive run time, memory churn, and overall poor performance
(observed in our environment).
The attached patch simply moves the call to getFileMap() outside the loop so
that it runs in O(gcCandidates.size) vs. O(gcCandidates.size * fileMap.size).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.