concept AMQ message store in category activemq

appears as: AMQ message store, The AMQ message store
ActiveMQ in Action

This is an excerpt from Manning's book ActiveMQ in Action.

The AMQ message store, like KahaDB, is a combination of a transactional journal for reliable persistence (to survive system crashes) and high-performance indexes, which makes this store the best option when message throughput is the main requirement for an application. But because it uses two separate files for every index, and there’s an index per destination, the AMQ message store shouldn’t be used if you intend to use thousands of queues per broker. Also, recovery can be slow if the ActiveMQ broker isn’t shut down cleanly. This is because all the indexes need to be rebuilt, which requires the broker to traverse all its data logs to accurately build the indexes again.

In the next section, we’ll briefly examine the internals of the AMQ message store, which are similar to the components of KahaDB.

The main components of the AMQ message store are similar to that of the KahaDB message store, in that there’s a cache, message data logs, and a reference store for accessing the data logs in order. Figure 5.5 provides a high-level diagram of the AMQ message store.

Figure 5.5. In the AMQ store messages are stored in referenced log files and cached for performance.

The diagram provides a view of the three distinct parts of the AMQ message store:

Table 5.2. Configuration properties for the AMQ message store

Property name

Default value

Description

directory activemq-data The directory path used by the AMQ message store.
useNIO true NIO provides faster write-through to the systems disks.
syncOnWrite false Syncs every write to disk.
syncOnTransaction true Syncs every transaction to disk.
maxFileLength 32mb The maximum size of the message journal data files before a new one is used.
persistentIndex true Persistent indexes are used. If false, an in-memory HashMap is used.
maxCheckpointMessageAddSize 4kb The maximum memory used for a transaction before writing to disk.
cleanupInterval 3000(ms) Time before checking which journal data files are still required.
checkpointInterval 20000(ms) Time before moving cached message IDs to the reference store indexes.
indexBinSize 1024 The initial number of hash bins to use for indexes.
indexMaxBinSize 16384 The maximum number of hash bins to use.
directoryArchive archive The directory path used by the AMQ message store to place archived journal files.
archiveDataLogs false If true, journal files are moved to the archive instead of being deleted.
recoverReferenceStore true Recovers the reference store if the broker isn’t shut down cleanly; this errs on the side of extreme caution.
forceRecoverReferenceStore false Forces a recovery of the reference store.