Skip to content

Tips & Tricks & Tweaks

Dannes Wessels edited this page Feb 25, 2018 · 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. Allowed values: yes, true, no, false,activemq and a full classname like org.apache.activemq.pool.PooledConnectionFactory

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.

As of version 0.9.11 this is switched on by default.

Auto reconnect (failover)

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" 

Set the loglevel to debug

The producer/master mainly logs on debug level unless something bad or unexpected happens.

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

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

Note that for eXist-db v2.x the log4j xml syntax is a bit different.

Note that for very old XAR versions the package name pattern is different: org.exist.replication.

Move collections to/from collections

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

Deep clean and removal of XARs

Sometimes a XAR file cannot be correctly deinstalled from eXist-db, e.g. because java classes are in use. As a work around the following instructions provide a rather complete cleanup and for a new install.

  • start eXist-db, uninstall both XARs via the package manager, when present
  • shutdown eXist-db
  • in webapp/WEB-INF/data/expathrepo remove all remaining ‘jms’ directories
  • in webapp/WEB-INF/data/expathrepo/.expath-pkg edit two files
    • packages.txt — remove the line containing the remaining jms lines
    • packages.xml — remove the elements of the remaining jms modules
Clone this wiki locally