Chapter 4. Using the LevelDB Persistence Adapter
Abstract
The LevelDB persistence adapter uses LevelDB as a high-performance message store. It allows for higher throughput speeds than the default message store.
Important
The LevelDB store is supported only on the Red Hat Enterprise Linux (RHEL) platform (for the RHEL versions and configurations specified in Supported Configurations). If you want to store the LevelDB files on a distributed file system, the following configuration is also supported: the broker itself and the LevelDB adapter plugin run on a supported RHEL platform, while the LevelDB files are stored on an NFSv4 file system (the O/S of the server that hosts the NFSv4 file system is irrelevant). Note that the distributed file system must be NFSv4.
For all other JBoss A-MQ-supported platforms, the LevelDB store is provided for technical preview only.
Overview
The LevelDB message store is a file based message store implemented using Google's LevelDB library to maintain indexes into log files holding the messages. The main advantages of the LevelDB store include:
- higher persistent throughput
- faster recovery times when a broker restarts
- supports concurrent read access
- no pausing during garbage collection cycles
- uses fewer read IO operations to load stored messages
- supports XA transactions
- checks for duplicate messages
- exposes status via JMX for monitoring
- supports replication
Platform support
LevelDB is implemented in C++, and Red Hat JBoss A-MQ accesses the libraries using a JNI driver.
JBoss A-MQ also provides an experimental pure Java driver for all other platforms.
Basic configuration
The LevelDB message store is configured by placing a
levelDB
element in the persistenceAdapter
element of your broker's configuration. The levelDB
element's attributes are used to configure the message store.
All attributes, listed in Table 4.1, “Configuration Properties of the LevelDB Message Store—standard LevelDB attributes”, have reasonable default values, so you are not required to specify values for them. However, you will need to explicitly specify the location of the message store's data files by providing a value for the
directory
attribute. This will ensure that the broker will not conflict with other brokers.
Example 4.1, “Configuring the LevelDB Message Store” shows a basic configuration of the LevelDB message store. The LevelDB files are stored under the
activemq-data
directory.
Example 4.1. Configuring the LevelDB Message Store
<broker brokerName="broker" persistent="true" ... > ... <persistenceAdapter> <levelDB directory="activemq-data" /> </persistenceAdapter> ... </broker>
Configuration attributes
Table 4.1, “Configuration Properties of the LevelDB Message Store—standard LevelDB attributes” describes the attributes that can be used to configure the LevelDB message store.