Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveMQ journal log size

Tags:

jms

activemq

I'm running ActiveMQ 5.3.0 (yup, gonna upgrade to 5.4.2, or even 5.5.0 soon) with KahaDB persistence adapter. It has 7 queues which are most of the time empty, that is, once message is put on queue it is being consumed in next 5-10 seconds. However volume of messages going thrugh is considerable (few thousands messages per day).

The problem is that KahaDB data directory is populated with numerous db-X.log files (where X is a integer). Every file is 32 MB in size and (since i'm running pretty much default configuration) it appears they are a journal redo logs (because default journal file length is 32mb). They take up valuable space (KahaDB is hosted on SSD volume) and seem redundant, since it seems to me that journal logs hold old (that is, dequeued) messages.

So the question is: how to get rid of journal log files? I just want KahaDB to store only pending messages.

As I have mentioned configuration is pretty much default. Broker element has only brokerName and dataDirectory attributes set, while kahaDB has only directory attribute set.

like image 302
Jacek Prucia Avatar asked May 30 '11 10:05

Jacek Prucia


People also ask

What is KahaDB ActiveMQ?

KahaDB is a file based persistence database that is local to the message broker that is using it. It has been optimized for fast persistence. It is the the default storage mechanism since ActiveMQ 5.4. KahaDB uses less file descriptors and provides faster recovery than its predecessor, the AMQ Message Store.

How does ActiveMQ store messages?

The AMQ message store directory structure. When you start ActiveMQ with the AMQ message store configured, a directory will automatically be created in which the persistent messages are held. The AMQ message store directory contains subdirectories for all the brokers that are running on the machine.


1 Answers

If you are using the default settings, then this should be working already. The only reason these files would remain is if you have a slow consumer and messages are backing up, etc...

The "cleanupInterval" attribute controls how frequently these files get cleaned up. By default, this is 30s...here is an example that sets it to 5 seconds (and reduces the journal size to 100kb for easier testing)

<kahaDB directory="${activemq.base}/data/kahadb" 
        journalMaxFileLength="100kb" 
        cleanupInterval="5000"/>
like image 177
Ben ODay Avatar answered Jan 03 '23 12:01

Ben ODay