Blog Articles

Configuring mKahaDB persistence storage for ActiveMQ

In this post, I wanted to address how to configure mKahaDB persistence storage on ActiveMQ for better management and reducing disk usage.

Default configured KahaDB persistence adapter works well when all the destinations (queues/topics) being managed by the broker have similar performance. However, an enterprise solution where several third parties are involved is never the case.

There are multiple queues or topics and different consumers or listeners listening to these queues/topics. Some consumers might be slower than other consumers. This will grow the message store’s disk usage rapidly. Due to this situation and being single KahaDB all store destinations might perform slow.

The multi KahaDB (mKahaDB) persistence adapter allows us to have a broker’s queues/topics across multiple KahaDB message stores. So, we can assign the different KahaDB store to different queues thus reducing the impact of slow performing destination (because of slow consumers) on normal or fast processing destinations. We can assign a separate KahaDB store to slow the performing destination with help of mKahaDB.

Let’s do a practice session.

1. We are using Red Hat JBoss Fuse/AMQ 6.3.0 for this practice session. The same should apply to all Red Hat JBoss/AMQ 6.x version or ActiveMq 5.x versions.
2. The broker’s configuration file activemq.xml exists in the etc folder of Red Hat JBoss Fuse/AMQ 6.3.0, we will be adding or modifying configurations to this file.
3. Let’s set memoryLimit of queues to a higher value i.e. 100 MB. So that we can send more messages of 1mb size to the broker.

txStore: This is an implementation detail of mKahaDB. It contains transactions that involve different KahaDB instances.

#210: This KahaDB store is for all expect the queues with specific/filtered KahaDB store.

queue#3a#2f#2fA.#2a.C: This KahaDB store is for queues with queue_name as expression A.*.C

queue#3a#2f#2fQ.#3e: This KahaDB store is for all queues starting with prefix ‘Q.>’. Where ‘>’ stands for any string.

queue#3a#2f#2fTest.#2a: This queue is specific for all queues with expression Test.*.

queue#3a#2f#2fX.Y.Z: This queue is specific for X.Y.Z queue.

7. mKahaDB is an extension of KahaDB, hence KahaDB tuning parameters applies for mKahaDB too. Just make sure for each filter, we would have to apply tuning parameters as each behaves as a separate KahaDB store. More details at activemq documentation.

8. We can use java code to send a message. But here I am using Red Hat JBoss Fuse/AMQKaraf terminal to send a message.

Scenario 1:KahaDB store for one specific queue. Now let use send data to X.Y.Z queue.

# If we check the file created in KahaDB store “queue#3a#2f#2fX.Y.Z”, we see journal files.

Scenario 4: When messages are sent to any other queues not mentioned in the filters. We will observe here that all the non-filtered messages will go to one different KahaDB store (i.e all within #210).

Download and learn more about Red Hat JBoss Fuse, an innovative modular, cloud-ready architecture, powerful management and automation, and world class developer productivity. It is Java™ EE 7 certified and features powerful, enterprise-grade features such as high availability clustering, distributed caching, messaging, transactions, and a full web services stack.