[
https://issues.apache.org/jira/browse/AMQ-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14288083#comment-14288083
]
Michael Rimov commented on AMQ-5527:
------------------------------------
I think my initial report was inaccurate and it didn't have to do with size.
Relevant setup:
{code}
<broker brokerName="testBroker"
xmlns="http://activemq.apache.org/schema/core" advisorySupport="true"
useJmx="true" offlineDurableSubscriberTimeout="10000" >
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry queue=">" optimizedDispatch="true"
producerFlowControl="false" memoryLimit="128mb" expireMessagesPeriod="300">
<deadLetterStrategy>
<individualDeadLetterStrategy queuePrefix="DLQ."
useQueueForQueueMessages="true"/>
</deadLetterStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<persistenceAdapter>
<jdbcPersistenceAdapter dataDirectory="${activemq.base}/data"
dataSource="#mysql-ds" lockKeepAlivePeriod="5000">
<locker>
<lease-database-locker lockAcquireSleepInterval="10000"
leaseHolderId="testBroker"/>
</locker>
</jdbcPersistenceAdapter>
</persistenceAdapter>
<transportConnectors>
<transportConnector name="nio" uri="nio://0.0.0.0:55540"/>
<transportConnector name="stomp+nio" uri="stomp+nio://0.0.0.0:61613"/>
</transportConnectors>
</broker>
<!-- MySql DataSource Setup -->
<bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="${jms.jdbc.url}"/>
<property name="username" value="${jms.jdbc.username}"/>
<property name="password" value="${jms.jdbc.password}"/>
<property name="maxActive" value="50"/>
<property name="poolPreparedStatements" value="false"/>
</bean>
{code}
If I was running the following test: (Disclaimer:Code was admittedly snagged
from AMQ5212, it may not always make sense :) )
{code}
import javax.jms.JMSException;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQMessageProducer;
import org.apache.activemq.ActiveMQSession;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTextMessage;
import org.junit.Test;
public class AMQ5527Test {
@Test
public void testSendMultipleMessagesToDLQ() throws JMSException {
//Whatever your local server is.
final ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("nio://localhost:55540");
connectionFactory.setCopyMessageOnSend(false);
connectionFactory.setWatchTopicAdvisories(false);
ActiveMQConnection activeMQConnection = (ActiveMQConnection)
connectionFactory.createConnection();
activeMQConnection.start();
//Create it as transacted so I can browse it afterwards in
JConsole
ActiveMQSession activeMQSession = (ActiveMQSession)
activeMQConnection.createSession(true, Session.CLIENT_ACKNOWLEDGE);
try {
ActiveMQQueue dest = new ActiveMQQueue("test-queue-"
+ getClass().getSimpleName());
ActiveMQMessageProducer activeMQMessageProducer =
(ActiveMQMessageProducer) activeMQSession.createProducer(dest);
// create demand so page in will happen
activeMQSession.createConsumer(dest);
ActiveMQTextMessage message = new ActiveMQTextMessage();
message.setDestination(dest);
activeMQMessageProducer.send(message, null);
// send a duplicate
activeMQConnection.syncSendPacket(message);
//Do it again.
activeMQConnection.syncSendPacket(message);
} finally {
activeMQSession.commit();
}
activeMQConnection.close();
}
}
{code}
and then go to the console. Select the main test queue. Go to OperationsPage
and click "browseAsTable"
CPU core usage immediately shot up to 170% usage (as reported by Mac Activity
Monitor) and it hasn't come out of it yet as I'm writing this report.
I hope this is more helpful.
> Performance issues for org.apache.activemq.broker.jmx.QueueView.removeMessage
> -----------------------------------------------------------------------------
>
> Key: AMQ-5527
> URL: https://issues.apache.org/jira/browse/AMQ-5527
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker, JMX
> Affects Versions: 5.10.0
> Environment: Mac/Linux
> Reporter: Michael Rimov
> Priority: Minor
> Labels: performance
>
> On large, persistent queues, (100,000+ messages), we're noticing huge
> performance issues with Queue.removeMessage(). (It takes 8-20 minutes to
> remove a single message).
> Thread dump while running showed this:
> "RMI TCP Connection(5)-192.168.1.10" daemon prio=5 tid=0x00007f8491954800
> nid=0x9807 runnable [0x000000011bfd7000]
> java.lang.Thread.State: RUNNABLE
> at
> org.apache.activemq.broker.region.cursors.OrderedPendingList.contains(OrderedPendingList.java:144)
> at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1913)
> at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1901)
> at
> org.apache.activemq.broker.region.Queue.removeMatchingMessages(Queue.java:1374)
> at
> org.apache.activemq.broker.region.Queue.removeMessage(Queue.java:1341)
> at
> org.apache.activemq.broker.jmx.QueueView.removeMessage(QueueView.java:60)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
> at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279)
> at
> com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
> at
> com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
> at
> com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
> at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
> at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252)
> at javax.management.StandardMBean.invoke(StandardMBean.java:405)
> at
> org.apache.activemq.broker.jmx.AnnotatedMBean.invoke(AnnotatedMBean.java:198)
> Strangely, the web admin console is completely responsive and attempting a
> delete through the web console is highly performant even on large queues.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)