13.3. Configuring the message journal
The message journal is configured using the following attributes in
<JBOSS_HOME>/jboss-as/server/<PROFILE>/deploy/hornetq/hornetq-configuration.xml
.
-
journal-directory
- The location of the message journal. The default value is
data/journal
. For best performance, this journal should be located on its own physical volume to minimize disk head movement. If this journal is stored on a storage area network, each journal instance on the network should have its own logical unit. -
create-journal-dir
- If
true
, the journal directory is created at the location specified injournal-directory
. The default value istrue
. -
journal-type
- Valid values are
NIO
orASYNCIO
. IfNIO
, the Java NIO journal is used. IfASYNCIO
, Linux asynchronous IO is used. IfASYNCIO
is set on a non-Linux or non-libaio system, HornetQ detects this and falls back toNIO
. -
journal-sync-transactional
- If
true
, HornetQ ensures all transaction data is flushed to disk on transaction boundaries (commit, prepare, and rollback). The default istrue
. -
journal-sync-non-transactional
- If
true
, HornetQ ensures non-transactional message data (sends and acknowledgments) are flushed to disk. The default istrue
. -
journal-file-size
- The size of each journal file in bytes. The default value is
10485760
bytes (10 megabytes). -
journal-min-files
- The minimum number of files the journal maintains. When HornetQ starts and there is no initial data, HornetQ pre-creates this number of files. Creating and padding journal files is an expensive operation, so to be avoided at run-time as files are filled. Pre-creating files means that as one is filled the journal can immediately resume with the next file without pausing to create it.
-
journal-max-io
- The maximum number of write requests to hold in the IO queue. Write requests are queued here before being submitted to the system for execution. If the queue fills, writes are blocked until space becomes available in the queue. For NIO, this must be
1
. For AIO, this should be500
. A different default value is maintained depending on whether NIO or AIO is used (1
for NIO,500
for AIO). The total max AIO must not be higher than what is configured at the operating system level (/proc/sys/fs/aio-max-nr
), generally at 65536. -
journal-buffer-timeout
- HornetQ maintains a buffer of flush requests, and flushes the entire buffer either when it is full or when this timeout expires - whichever is soonest. This is used for both NIO and AIO and allows improved scaling when many concurrent writes and flushes are required.
-
journal-buffer-size
- The size of the timed buffer on AIO. The default value is
490
kilobytes. -
journal-compact-min-files
- The minimum number of files before the journal will be compacted. The default value is
10
. -
journal-compact-percentage
- When less than this percentage of a journal is considered live data compacting will occur. The default value is
30
.journal-compact-min-files
must also be fulfilled before compacting.
Warning
Most disks contain hardware write caches, which increase the apparent performance of a disk because writes are cached and lazily written to disk later.
Many systems ship with disk write cache enabled by default, so even after syncing from the operating system there is no guarantee that the data has been written to disk. If a failure occurs, critical data can still be lost.
Some systems have non-volatile or battery-backed write caches. These will not necessarily lose data in the event of failure, but testing is essential.
If your disk does not have these backups in place, and is not part of a redundant array (for example, RAID), ensure that disk write cache is
disabled
. This can have negative effects on performance, but ensures data integrity.
On Linux, inspect or change your disk's write cache settings with the hdparm tool for IDE disks, or sdparm or sginfo tools for SCSI or SATA disks.
On Windows, check or change settings by right-clicking on the disk and selecting Properties.