ActiveMQ : High CPU usage even though the message load on broker is small.

Solution Verified - Updated -


  • Broker: Fuse MB 5.5.0.fuse-00-43

  • Client: Fuse MR/Camel - 2.7.1.fuse-00-43, Fuse ESB/apache-servicemix 4.4.0-fuse-00-43


  • ActiveMQ is using a lot of CPU even though no messages are being sent or consumed from the broker.


In this case the broker consumer was a camel route. The camel-jms component was using the default value for cacheLevelName CACHE_AUTO. As this was a transacted camel route CACHE_AUTO is actually using CACHE_NONE.By default the camel-jms consumer checks the queue every second for a message. The CACHE_NONE causes a JMS Connection, JMS Session and JMS Consumer to be created and destroyed for each poll. With many concurrent consumers on the route this was creating considerable load on the broker.

As the route is only using JMS Local Transactions with ActiveMQ broker and not XA transactions it is safe to change the cacheLevelName to CACHE_CONSUMER. This allow the JMS resources to be reused and not created/destroyed on each check on the queue.

Diagnostic Steps

1) increase logging to DEBUG in the broker and see if consumers are being created and destroyed immediately

2) connect to the Brokers MBeans using Jconsole or another JMX client. Go to "org.apache.activemq" -> -> "subscription" -> non-durable -> queue -> -> . The Consumers associated with that connection for that particular queue are listed at that level. Check if the subscriptions ID change quickly(every second or less). This could indicate that consumers are not being cached.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.