lmdb · shipping · also Lightning Memory-Mapped Database

LMDB

LMDB is an embedded transactional key-value database that uses memory-mapped B+ trees, copy-on-write updates and multi-version concurrency control.

Related Observatory article: Read on hesela.com

The original MDB design separates the application tree from a transaction-indexed free-page tree. [1] A pinned C-API experiment kept eight 16 KiB values while varying reader lifetime; an active snapshot exhausted fixed 1 MiB and 2 MiB maps, whereas ended and reset-reader controls completed 256 overwrites. These are constructed observations, not a benchmark or failure-rate estimate. [4]

A follow-up with a stalled backup receiver exhausted both fixed maps during plain and compact copying; draining the copy restored 64 further writes. Compact output was smaller without reducing source retention. All 24 constructed cases reopened the backup and checked every value. [6]

In 40 controlled lifecycle cases, killing a separate reader left writes at MDB_MAP_FULL until explicit reader checking cleared its abandoned entries. The tested unreaped child still had a visible PID, but cleanup restored writes at unchanged capacity. These are one-build observations, not incident rates or power-loss results. [7]

Custom comparison behavior must match the stored tree and be registered before data access. [2] A synthetic 0.9.33 fixture retained all 257 key/value pairs in a scan, but default-order lookups found none in its descending tree. Native/compact copies retained this dependence; normal dump/load rebuilt ascending order. No data loss or new defect was established. [10]

Append loading (-a) retains input order, assumes correct sorting and skips sorting/redundancy checks. It does not supply the original callback to later processes. [8] [9]

Relations

related
LMDB reader table, Copy-on-write (storage), Snapshot isolation, B+ tree

Limitations

  • Map capacity, reusable pages and live payload bytes are different quantities; these test counts are not universal thresholds. [4]
  • The comparator fixtures cover one pinned release and two optimization settings on one host; they exclude duplicate-key databases and writes under mismatched ordering. [2, 10]

Citations

  1. Howard Chu. MDB: A Memory-Mapped Database and Backend for OpenLDAP. LDAPCon 2011, sections 3.2 and 4.2. (accessed 2026-10-16)
  2. LMDB 0.9.33 API: transaction lifetime, map capacity, reader checks and mdb_set_compare contract (accessed 2026-10-16)
  3. Hesela: controlled LMDB reader-lifetime experiment, complete results and limits (accessed 2026-10-16)
  4. Hesela: 24 controlled LMDB copy-backpressure observations, hashes and limits (accessed 2026-10-20)
  5. Hesela: 40 controlled LMDB reader-death and cleanup cases, method and limits (accessed 2026-10-22)
  6. LMDB 0.9.33 mdb_load manual: -a ordering precondition and skipped checks (accessed 2026-10-25)
  7. LMDB 0.9.33 loader implementation: greater callback and append loading (accessed 2026-10-25)
  8. Hesela: LMDB comparator-contract fixtures, 120 retained observations and reproducible inputs (accessed 2026-10-25)

Further reading

  1. LMDB 0.9.33 implementation: mdb_find_oldest, mdb_page_alloc and mdb_reader_check0 (accessed 2026-10-16)
  2. LMDB readers: a stable snapshot can exhaust a fixed map (accessed 2026-10-16)

JSON: /data/terms/lmdb.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. LMDB. Hesela. 2026-10-25. https://hesela.dev/terms/lmdb/