You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "David Sitsky (JIRA)" <ji...@apache.org> on 2015/11/28 05:33:10 UTC

[jira] [Created] (AMQ-6066) Performance issue in OrderedPendingList

David Sitsky created AMQ-6066:
---------------------------------

             Summary: Performance issue in OrderedPendingList
                 Key: AMQ-6066
                 URL: https://issues.apache.org/jira/browse/AMQ-6066
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.12.1
            Reporter: David Sitsky
             Fix For: 5.13.0


I have updated my application from ActiveMQ 5.3 to 5.11.1 and have noticed a serious performance degregation.  Running a number of jstacks I can see the broker is often stuck here:
{noformat}
"Queue:master-items" Id=122 RUNNABLE
	at org.apache.activemq.broker.region.cursors.OrderedPendingList.contains(OrderedPendingList.java:144)
	at org.apache.activemq.broker.region.Queue.doPageInForDispatch(Queue.java:1930)
	at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:2119)
	at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1596)
	-  locked java.lang.Object@253c3089
	at org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:112)
	at org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:42)

	Number of locked synchronizers = 1
	- java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@2eb46567
{noformat}
For this specific queue in my application, there were a large number of items in it.. around 100,000.  However I noticed the code for contains has:
{code}
    public boolean contains(MessageReference message) {
        if (message != null) {
            for (PendingNode value : map.values()) {
                if (value.getMessage().equals(message)) {
                    return true;
                }
            }
        }
        return false;
    }
{code}
This will obviously be very slow.  Given the Map is keyed by message ID, can't we do a .contains(message.getMessageId()) instead?  I noticed the remove() method does this.  I changed the code to do this:
{code}
@Override
public boolean contains(MessageReference message) {
    if (message != null) {
        return map.containsKey(message.getMessageId());
    }
    return false;
}
{code}
I got a speedup for my test which now takes 29 minutes from 41 minutes.  Can we get this change in to the upcoming 5.13 release (pretty please??)  It is a tiny (but very important) change for us.. many thanks.



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