Skip to content

Tips & Tricks & Tweaks

Dannes Wessels edited this page Dec 30, 2013 · 23 revisions

connection pooling

Enable connection pooling by setting the "exist.connection.pool" parameter:

"exist.connection.pool" := "yes"

This will enable the reuse of JMS objects which are for the JVM rather expensive to create.

About the potential performance improvements: In the provided demonstration scripts I increased the nr of repetitional sends to 10000. Without buffering it takes 130 seconds (77 messages/sec), with connection buffering it only takes 22.6 seconds (443 messages/sec). That is an improvement of a factor of (almost) 6!

note: this only works when using the ActiveMQ jars (provided in the XAR files)

auto reconnect

Under some conditions (e.g. during hibernation of a notebook) a connection to a broker can get lost. In the exist.log file this situation is logged the following way:

''' 2013-12-30 20:57:40,330 [ActiveMQ Connection Executor: tcp://myserver.local/192.168.1.23:61616@60153] ERROR (JmsConnectionExceptionListener.java [onException]:49) - Connection reset javax.jms.JMSException: Connection reset at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54) at org.apache.activemq.ActiveMQConnection.onAsyncException(ActiveMQConnection.java:1983) at org.apache.activemq.ActiveMQConnection.onException(ActiveMQConnection.java:2002) at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:101) at org.apache.activemq.transport.ResponseCorrelator.onException(ResponseCorrelator.java:126) at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:101) at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:101) at org.apache.activemq.transport.WireFormatNegotiator.onException(WireFormatNegotiator.java:160) at org.apache.activemq.transport.AbstractInactivityMonitor.onException(AbstractInactivityMonitor.java:314) at org.apache.activemq.transport.TransportSupport.onException(TransportSupport.java:96) at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:200) at java.lang.Thread.run(Thread.java:744) '''

The connection needs to be re-setup.

Fortunately ActiveMQ provides a reconnection feature to automatically reconnect to the broker. More details can be found on the ActiveMQ documentation.

Clone this wiki locally