JBoss.org Community Documentation

- Prev
- Next

## Chapter 40. Libaio Native Libraries

HornetQ distributes a native library, used as a bridge between HornetQ and linux libaio.

`libaio` is a library, developed as part of the linux kernel project. With `libaio` we submit writes to the operating system where they are processed asynchronously. Some time later the OS will call our code back when they have been processed.

We use this in our high performance journal if configured to do so, please see Chapter 15, Persistence.

These are the native libraries distributed by HornetQ:

- libHornetQAIO32.so - x86 32 bits

- libHornetQAIO64.so - x86 64 bits

When using libaio, HornetQ will always try loading these files as long as they are on the library path.

## 40.1. Compiling the native libraries

In the case that you are using Linux on a platform other than x86_32 or x86_64 (for example Itanium 64 bits or IBM Power) you may need to compile the native library, since we do not distribute binaries for those platforms with the release.

### 40.1.1. Install requirements

## Note

At the moment the native layer is only available on Linux. If you are in a platform other than Linux the native compilation will not work

The native library uses autoconf what makes the compilation process easy, however you need to install extra packages as a requirement for compilation:

- gcc - C Compiler

- gcc-c++ or g++ - Extension to gcc with support for C++

- autoconf - Tool for automating native build process

- make - Plain old make

- automake - Tool for automating make generation

- libtool - Tool for link editing native libraries

- libaio - library to disk asynchronous IO kernel functions

- libaio-dev - Compilation support for libaio

- A full JDK installed with the environment variable JAVA_HOME set to its location

To perform this installation on RHEL or Fedora, you can simply type this at a command line:

    sudo yum install automake libtool autoconf gcc-g++ gcc libaio libaio-dev make

Or on debian systems:

    sudo apt-get install automake libtool autoconf gcc-g++ gcc libaio libaio-dev make

## Note

You could find a slight variation of the package names depending on the version and linux distribution. (for example gcc-c++ on Fedora versus g++ on Debian systems)

### 40.1.2. Invoking the compilation

In the distribution, in the `native-src` directory, execute the shell script `bootstrap`. This script will invoke `automake` and `make` what will create all the make files and the native library.

    someUser@someBox:/messaging-distribution/native-src$ ./bootstrap
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p

    ...

    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating ./src/Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    config.status: executing libtool commands

    ...

The produced library will be at `./native-src/src/.libs/libHornetQAIO.so`. Simply move that file over `bin` on the distribution or the place you have chosen on the library path.

If you want to perform changes on the HornetQ libaio code, you could just call make directly at the `native-src` directory.

- PrevChapter 39. High Availability and Failover
- Top of page
- Front page
- NextChapter 41. Thread management