LmdbJava provides an extremely low latency JNR-FFI-based binding to the LMDB native library. LMDB is an ultra-fast, ultra-compact, b-tree ordered, embedded, key-value store developed by Symas for the OpenLDAP Project.
LMDB uses memory-mapped files, so it has the read performance of a pure in-memory database while still offering the persistence of standard disk-based databases. It is transactional with full ACID semantics and crash-proof by design. No journal files. No corruption. No startup time. No dependencies. No config tuning. LMDB is the perfect foundation for large, read-centric, single node workloads that require strong latency and operational robustness outcomes.
- Install
liblmdbfor your platform (eg Arch Linux:pacman -S lmdb) - Clone this repository and
mvn clean install(Maven Central coming soon) - Add the
lmdbjavaartifact to your project POM - Browse the LMDB Documentation (especially the Getting Started page)
- Take a look at our tests (the LmdbJava class names and contracts closely match the LMDB C API)
We're happy to help you use LmdbJava. Simply open a GitHub issue if you have any questions.
Contributions are welcome! Please see the Contributing Guidelines.
For years Java users have been able to access LMDB via LMDBJNI. Its public API is mature and widely used, but this makes it challenging to implement any substantial changes.
LmdbJava was created to provide a new LMDB abstraction without the backward
compatibility consideration. A separate project also offered a convenient
opportunity to implement many internal changes to reduce latency and long-term
maintenance costs. For example, we moved from HawtJNI to JNR-FFI (for its active
community, lower latency, Java 9 roadmap and much simpler build requirements). We
also significantly reduced and isolated Unsafe use, with only a single method
now requiring it (and there is an automatic reflective fallback if Unsafe isn't
available). Overall these changes make LmdbJava the optimal choice for projects
targeting server-class JVMs, and it will be easy to support Java 9 when released.
This project is licensed under the Apache License, Version 2.0.
You must separately install the LMDB library. LMDB is currently licensed under The OpenLDAP Public License.