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

Performance issue in PrioritizedPendingListIterator

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.12.2
    • Fix Version/s: 5.14.0
    • Component/s: Broker
    • Labels:
      None

      Description

      Sending and consuming 5000 messages to/from a queue, one can see heavy CPU use on the broker side (v 5.12.2).
      Yourkit shows

      PrioritizedPendingList$PrioritizedPendingListIterator.<init>

      as a hot spot method. It calls ArrayList.add(Object) around 12 mio times.

      Situation is that FilePendingMessageCursor.isEmpty() iterates over in-memory messages and therefore (as it is a prioritized queue) uses PrioritizedPendingListIterator which uses OrderedPendingList.getAsList() which overall turns out to be an expensive method as it converts the self-managed linked list to a Java ArrayList and then this list is filled into another ArrayList managed by PrioritizedPendingListIterator.

      PrioritizedPendingListIterator could be improved to walk the priority lists via OrderedPendingList iterators, as these are implemented efficiently.

        Attachments

        1. AMQ-6239-flight-recorder.jpg
          98 kB
          Martin Lichtin
        2. AMQ-6239-yourkit-1.jpg
          117 kB
          Martin Lichtin
        3. PrioritizedPendingList.java.patch
          2 kB
          Martin Lichtin

          Activity

            People

            • Assignee:
              tabish Timothy Bish
              Reporter:
              lichtin Martin Lichtin
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: