The LevelDB Store is a file based persistence database that is local to the message broker that is using it. It has been optimized to provide even faster persistence than KahaDB. It's similar to KahahDB but instead of using a custom BTree implementation to index the write ahead logs, it uses LevelDB based indexes which have several nice properties due to the 'append only' files access patterns :
- Fast updates (No need to do random disk updates)
- Concurrent reads
- Fast index snapshots using hard links
Both KahaDB and the LevelDB store have to do periodic garbage collection cycles to determine which log files can deleted. In the case of KahaDB, this can be quite expensive as you increase the amount of data stored and can cause read/write stalls while the collection occurs. The LevelDB store uses a much cheaper algorithm to determine when log files can be collected and avoids those stalls.
You can configure ActiveMQ to use LevelDB for its persistence adapter like below,
LevelDB Store Vs KahaDB
- Fewer index entries per message than KahaDB.
- Faster recovery when a broker restarts.
- LevelDB index out-perform Btree index at sequential access.
- LevelDB indexes support concurrent read access.
- Pauseless date log file garbage collection cycles.
- Fewer IOPS to load stored messages.
- It exposes it's status via JMX for monitoring.