ActiveMQ V5.9

In ActiveMQ 5.9, the Replicated LevelDB Store is introduced. It handles using Apache ZooKeeper to pick a master from a set of broker nodes configured to replicate single LevelDB Store. Then synchronizes all slave LevelDB Stores with the master keeps them up to date by replicating all updates to the master. This might become the preferred Master Slave configuration going forward.

ActiveMQ V5.8

In ActiveMQ 5.8, the LevelDB Store was introduced. The LevelDB Store is a file based persistence database. It has been optimized to provide even faster persistence than KahaDB. Although not yet the default message store, we expect this store implementation become the default in future releases.

ActiveMQ V5.3

From 5.3 onwards - we recommend you use KahaDB - which offers improved scalability and recoverability over the AMQ Message Store.
The AMQ Message Store which although faster than KahaDB - does not scales as well as KahaDB and recovery times take longer.

ActiveMQ V4

For long term persistence we recommend using JDBC coupled with our high performance journal. You can use just JDBC if you wish but its quite slow.

Our out of the box default configuration uses Apache Derby as the default database, which is easy to embed - but we support all the major SQL databases - just reconfigure your JDBC configuration in the Xml Configuration.

High performance journal - ActiveMQ 4.x

To achieve high performance of durable messaging in ACtiveMQ V4.x we strongly recommend you use our high performance journal - which is enabled by default. This works rather like a database; messages (and transcation commits/rollbacks and message acknowledgements) are written to the journal as fast as is humanly possible - then at intervals we checkpoint the journal to the long term persistence storage (in this case JDBC).

Its common when using queues for example that messages are consumed fairly shortly after being published; so you could publish 10,000 messages and only have a few messages outstanding - so when we checkpoint to the JDBC database, we often have only a small amount of messages to actually write to JDBC. Even if we have to write all the messages to the JDBC, we still get performance gains with the journal, since we can use a large transaction batch to insert the messages into the JDBC database to boost performance on the JDBC side.

Our journal is based on lots of the great work in the Howl project; we keep close ties to the Howl community. However since ActiveMQ has to handle arbitarily large message sizes, we've had to make our journal handle any size of message and so we don't use the fixed size record model that Howl uses.

Configuring persistence

For full explict control over configuration check out the Xml Configuration. However a quick way to set which persistence adapter to use is to set the following system property to be the class name of the PersistenceAdapter implementation.

When running the broker from the command line, we look for the activemq.xml on the classpath unless you specify one to use. e.g.
AMQ 4.x

AMQ 3.x

or just
AMQ3.x/AMQ4.x

Here is a sample XML configuration which shows how to configure the journal and the JDBC persistence.

AMQ 4.x

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

For more details see the Initial Configuration guide.

JDBC Persistence without Journaling

To enable JDBC persistence of JMS messages without journaling, we need to change the message broker's default persistence configuration from
AMQ 4.x

to

For AMQ 3.x

to

Make sure to send durable messages so that it will be persisted in the database server while waiting to be consumed by clients. More information on configuration JDBC persistence at JDBC Support

Kaha Persistence

Kaha Peristence is a storage solution written especially for message persistence and is part of the ActiveMQ project. It's tuned to provide optimal performance for typical message usage patterns, which involves writing/reading and discarding messages that are persisted very quickly.

Data stored in Kaha is appended to data logs - the log files are discarded once there is no longer interest in the data contained in the log.

Configuring Kaha Persistence

In the broker XML specify the persistence adaptor to be Kaha e.g.

ActiveMQ 5.0 and above:

ActiveMQ 4.1 and earlier:

Disaster Recovery options

For people with high DR requirements we have various options for providing a Replicated Message Store to allow full failover in times of major data centre failure.

Disabling Persistence

If you don't want persistence at all you can disable it easily via the Xml Configuration. e.g.

This will make the broker use the <memoryPersistenceAdapter>
For an example of using a configuration URI see How to unit test JMS code

© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram