6.2. Exploiting HornetQ's Support of Linux's Native Asynchronous I/O

If JBoss Enterprise Application Platform is running on Red Hat Enterprise Linux (RHEL), you can take advantage of HornetQ's ability to leverage Linux's native asynchronous I/O for its journal. HornetQ has moved from the database approach of JBoss Messaging for persistent messages to a new high performance journal that exists on the file system. Since this journal lives on the file system, HornetQ uses Java's New Input/Output (NIO) routines as the mechanism for reading and writing the journal. There is also a native library, that if detected, will enable HornetQ to leverage Linux's native asynchronous I/O capabilities. This has to be done in “native” code, as Java does not directly support OS asynchronous I/O. Using the operating system's own asynchronous I/O provides the best possible performance and scalability. To enable this option two steps are required.
The first step is to ensure that the libaio package is installed on your instance of RHEL. This package provides the API for HornetQ's native code that allows it to use asynchronous I/O. With the libaio package installed, the next step is to ensure the native code for HornetQ is available. That has to be placed at the same directory level as your EAP instance. For example, if you have EAP installed in /opt/redhat/jboss-eap-5.1, then the native code must be put in the same directory. This is because, being native code, it must be the right version for your RHEL version, and the right libraries for the JVM. Both the 32-bit and 64-bit JVMs are supported so there are 32-bit and 64-bit versions of the libraries. The run.sh script will automatically detect the directory relative to the EAP installation directory and resulting JBOSS_HOME that is set within that script (run.bat for Windows won’t have this, as this is a Linux only feature). If you have everything installed correctly, you should see this message in the log after start up.
10:50:05,113 INFO  [JournalStorageManager] Using AIO Journal
If you do not have everything installed correctly, you will see a message like the following:
2011-02-18 10:05:11,485 WARNING [org.hornetq.core.deployers.impl.FileConfigurationParser] (main) AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal

Note

These installation instructions are only for zip based installations. If you are using the EAP RPM installation method then everything should be placed in the correct locations by the RPM.