You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Christopher L. Shannon (JIRA)" <ji...@apache.org> on 2016/04/11 15:24:25 UTC

[jira] [Comment Edited] (AMQ-6239) Performance issue in PrioritizedPendingListIterator

    [ https://issues.apache.org/jira/browse/AMQ-6239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15235073#comment-15235073 ] 

Christopher L. Shannon edited comment on AMQ-6239 at 4/11/16 1:23 PM:
----------------------------------------------------------------------

I'm not sure if thread safety is a big issue here without looking deeper into it.  I believe every place the pending lists are used either have new lists allocated for that thread, or there is synchronization done at a higher level, such as the FilePendingMessageCursor which uses synchronized on adds and removes.  But that's a good point and it should at least be double checked to make sure there are no thread safety issues here.


was (Author: christopher.l.shannon):
I'm not sure if thread safety is a big issue here without looking deeper into it.  I believe every place the pending lists are used either have new lists allocated for that thread, or there is synchronization done at a higher level, such as the FilePendingMessageCursor which uses synchronized on adds and removes.

> Performance issue in PrioritizedPendingListIterator
> ---------------------------------------------------
>
>                 Key: AMQ-6239
>                 URL: https://issues.apache.org/jira/browse/AMQ-6239
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 5.12.2
>            Reporter: Martin Lichtin
>         Attachments: AMQ-6239-yourkit-1.jpg, PrioritizedPendingList.java.patch
>
>
> 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. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)