KahaDB like the AMQ Message Store is a file based persistence database that is local the message broker that is using it. It makes some trade-offs for scalability and recovery versus performance compared to the AMQ Message Store. Although marginally slower, it is not limited by the number of file descriptors available to the message broker process and also recovery is extremely fast.
Configuration
You can configure ActiveMQ to use KahaDB for its persistence adapter - like below :
<broker brokerName="broker" persistent="true" useShutdownHook="false">
<persistenceAdapter>
<kahaDB directory="activemq-data" journalMaxFileLength="32mb"/>
</persistenceAdapter>
<transportConnectors>
<transportConnector uri="tcp:/>
</transportConnectors>
</broker>
KahaDB Properties
| property name |
default value |
Comments |
| directory |
activemq-data |
the path to the directory to use to store the message store data and log files |
| indexWriteBatchSize |
1000 |
number of indexes written in a batch |
| indexCacheSize |
100 |
number of index pages cached in memory |
| enableIndexWriteAsync |
false |
if set, will asynchronously write indexes |
| journalMaxFileLength |
32mb |
a hint to set the maximum size of the message data logs |
| enableJournalDiskSyncs |
true |
ensure every non transactional journal write is followed by a disk sync (JMS durability requirement) |
| maxCheckpointMessageAddSize |
4kb |
the maximum number of messages to keep in a transaction before automatically committing |
| cleanupInterval |
30000 |
time (ms) before checking for a discarding/moving message data logs that are no longer used |
| checkpointInterval |
5000 |
time (ms) before checkpointing the journal |