Este conteúdo não está disponível no idioma selecionado.

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 at the cost of potentially higher CPU usage and message store size.
Important
The LevelDB store is available only on Windows, Linux, and Mac OS platforms.

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
  • exposes status via JMX for monitoring
  • supports replication
The LevelDB store does have a few known limitations:
  • does not support XA transactions
  • does not check for duplicate messages

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 that can be used as well.
The JNI driver is used by default on the following platforms:
  • Linux
  • OS X
  • Windows Vista
  • Windows Server 2008
Important
Windows platforms require the MS VC++ 2010 Redistributable package:
All other platforms use the experimental Java drivers.

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.
The attributes, listed in Table 4.1, “Configuration Properties of the LevelDB Message Store”, all have reasonable default values, so you are not required to specify values for them. However, you will want 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>
Copy to Clipboard Toggle word wrap

Configuration attributes

Table 4.1, “Configuration Properties of the LevelDB Message Store” describes the attributes that can be used to configure the LevelDB message store.
Expand
Table 4.1. Configuration Properties of the LevelDB Message Store
AttributeDefault ValueDescription
directory activemq-dataSpecifies the path to the top-level folder that holds the message store's data files.
flushDelay 500Specifies the amount of time in milliseconds that a store will delay persisting a messaging unit of work in hopes that it will be invalidated shortly thereafter by another unit of work which would negate the operation.
readThreads 10Specifies he number of concurrent IO reads to allow.
sync trueSpecifies if the syncs logging operations to disk.
logSize 104857600Specifies the maximum size, in bytes, of each data log file before log file rotation occurs.
logWriteBufferSize 4194304Specifies the maximum amount of log data, in bytes, to build up before writing to the file system.
verifyChecksums falseSpecifies if checksum verification is performed on all data that is read from the file system.
paranoidChecks falseSpecifies if the store errors out as soon as possible if it detects internal corruption.
indexMaxOpenFiles 1000Specifies the number of open files that can be used by the index.
indexBlockRestartInterval 16Specifies the number of keys between restart points for delta encoding of keys.
indexWriteBufferSize 4194304Specifies the amount of index data to build up in memory before converting to a sorted on-disk file.
indexBlockSize 4096Specifies the size, in bytes, of index data packed per block.
indexCacheSize 268435456Specifies the maximum amount of memory, in bytes, to use to cache index blocks.
indexCompression snappySpecifies the type of compression to apply to the index blocks. Can be snappy or none.
logCompression snappySpecifies the type of compression to apply to the log records. Can be snappy or none.
indexFactory org.fusesource.leveldbjni.JniDBFactory, org.iq80.leveldb.impl.Iq80DBFactory
Specifies a comma separated list of leveldb API implementation factory classes that the broker will attempt to load. The broker will use the first one that loads successfully.
  • org.fusesource.leveldbjni.JniDBFactory enables the JNI base implementation
  • org.iq80.leveldb.impl.Iq80DBFactory enables the pure Java implementation
asyncBufferSize 4096Specifies the amount of memory, in bytes, to use for buffering asynchronous writes to disk.
failIfLocked falseSpecifies if the broker will fail on start up if the message store's data files are locked. If the broker does not fail it will block until the data files are unlocked.
useLocktrueSpecifies in the adapter uses file locking.
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2026 Red Hat
Voltar ao topo