Configure the Message Journal
15.3. Configuring the message journal The message journal is configured using the following attributes in hornetq-configuration.xml journal-directory This is the directory in which the message journal lives. The default value is data/journal. For the best performance, we recommend the journal is located on its own physical volume in order to minimise disk head movement. If the journal is on a volume which is shared with other processes which might be writing other files (e.g. bindings journal, database, or transaction coordinator) then the disk head may well be moving rapidly between these files as it writes them, thus drastically reducing performance. When the message journal is stored on a SAN we recommend each journal instance that is stored on the SAN is given its own LUN (logical unit). create-journal-dir If this is set to true then the journal directory will be automatically created at the location specified in journal-directory if it does not already exist. The default value is true journal-type Valid values are NIO or ASYNCIO. Choosing NIO chooses the Java NIO journal. Choosing AIO chooses the Linux asynchronous IO journal. If you choose AIO but are not running Linux or you do not have libaio installed then HornetQ will detect this and automatically fall back to using NIO. journal-sync-transactional If this is set to true then HornetQ will make sure all transaction data is flushed to disk on transaction boundaries (commit, prepare and rollback). The default value is true. journal-sync-non-transactional If this is set to true then HornetQ will make sure non transactional message data (sends and acknowledgements) are flushed to disk each time. The default value for this is true. journal-file-size The size of each journal file in bytes. The default value for this is 10485760 bytes (10MiB). journal-min-files The minimum number of files the journal will maintain. When HornetQ starts and there is no initial message data, HornetQ will pre-create journal-min-files number of files. Creating journal files and filling them with padding is a fairly expensive operation and we want to minimise doing this at run-time as files get filled. By precreating files, as one is filled the journal can immediately resume with the next one without pausing to create it. Depending on how much data you expect your queues to contain at steady state you should tune this number of files to match that total amount of data. journal-max-io Write requests are queued up before being submitted to the system for execution. This parameter controls the maximum number of write requests that can be in the IO queue at any one time. If the queue becomes full then writes will block until space is freed up. When using NIO, this value should always be equal to 1 When using AIO, the default should be 500. The system maintains different defaults for this parameter depening on whether it's NIO or AIO (default for NIO is 1, default for AIO is 500) There is a limit and the total max AIO can't be higher than what is configured at the OS level (/proc/sys/fs/aio-max-nr) usually at 65536. journal-buffer-timeout Instead of flushing on every write that requires a flush, we maintain an internal buffer, and flush the entire buffer either when it is full, or when a timeout expires, whichever is sooner. This is used for both NIO and AIO and allows the system to scale better with many concurrent writes that require flushing. This parameter controls the timeout at which the buffer will be flushed if it hasn't filled already. AIO can typically cope with a higher flush rate than NIO, so the system maintains different defaults for both NIO and AIO (default for NIO is 3333333 nanoseconds - 300 times per second, default for AIO is 500000 nanoseconds - ie. 2000 times per second). Note By increasing the timeout, you may be able to increase system throughput at the expense of latency, the default parameters are chosen to give a reasonable balance between throughput and latency. journal-buffer-size The size of the timed buffer on AIO. The default value is 490KiB. journal-compact-min-files The minimal number of files before we can consider compacting the journal. The compacting algorithm won't start until you have at least journal-compact-min-files The default for this parameter is 10 journal-compact-percentage The threshold to start compacting. When less than this percentage is considered live data, we start compacting. Note also that compacting won't kick in until you have at least journal-compact-min-files data files on the journal The default for this parameter is 30