Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-3162

ActiveMQ checkpoint worker makes unnecessary repeated calls to Journal.getFileMap(), leading to excessive memory usage

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.4.2
    • 5.5.0
    • None
    • None
    • Patch Available

    Description

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

      Attachments

        1. avoid-getfilemap.patch
          2 kB
          Craig Condit

        Activity

          People

            gtully Gary Tully
            ccondit Craig Condit
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: