Package org.lmdbjava

Lightning Memory Database (LMDB) for Java (LmdbJava).

LmdbJava is intended for extremely low latency use cases. Users are required to understand and comply with the LMDB C API contract (eg handle usage patterns, thread binding, process rules).

Priorities:

  1. Minimize latency, particularly on any critical path (see below)
  2. Preserve the LMDB C API model as far as practical
  3. Apply Java idioms only when not in conflict with the above
  4. Fully encapsulate (hide) the native call library and patterns
  5. Don't require runtime dependencies beyond the native call library
  6. Support official JVMs running on typical 64-bit operating systems
  7. Prepare for Java 9 (eg Unsafe, native call technology roadmap etc)

Critical paths of special latency focus:

  • Releasing and renewing a read-only transaction
  • Any operation that uses a cursor

The classes in LmdbJava DO NOT provide any concurrency guarantees. Instead you MUST observe LMDB's specific thread rules (eg do not share transactions between threads). LmdbJava does not shield you from these requirements, as doing so would impose locking overhead on use cases that may not require it or have already carefully implemented application threading (as most low latency applications do to optimize the memory hierarchy, core pinning etc).

Most methods in this package will throw a standard Java exception for failing preconditions (eg NullPointerException if a mandatory argument was missing) or a subclass of LmdbException for precondition or LMDB C failures. The majority of LMDB exceptions indicate an API usage or Env configuration issues, and as such are typically unrecoverable.