Skip to content

Tips & Tricks & Tweaks

Dannes Wessels edited this page Jun 23, 2016 · 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 (as provided in the released XAR files). The feature depends on the ActiveMQ PooledConnectionFactory class.

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: "How can I support auto reconnection?" and "The Failover Transport".

"java.naming.provider.url" := "failover:tcp://host:61616" 

debug

To see debug messages, update log4j2.xml in the EXIST_HOME directory:

<Logger name="org.exist.jms" additivity="false" level="debug">
  <AppenderRef ref="exist.core"/>
</Logger>

move collection

If collection a must be moved from /db/b to /db/c and then back to /db/b, for both collections /db/band /db/c a replication trigger must defined in the corresponding 'collection.xconf' documents.

Clone this wiki locally