talira

Lightning Memory-Mapped Database: a tiny, crash-proof embedded key-value store

open sourceOLDAP-2.8free

LMDB (Lightning Memory-Mapped Database) is an embedded, transactional key-value store written in C by Symas for the OpenLDAP Project. It maps the database file into memory, so reads are zero-copy and run at in-memory speed while the data stays on disk, and it gives full ACID transactions with MVCC: readers never block writers, writers never block readers, and several processes can share one environment. Keys are kept sorted for range lookups, an environment holds multiple sub-databases, and it needs no logs, compaction or crash recovery. The library is about 32 KB of object code.

Ways to install

Package managers

Problems it solves

  • an embedded key-value store that can't corrupt its data when the process crashes
  • read from a local database as fast as memory without writing my own cache
  • share one on-disk database between several processes on the same machine

Features

  • memory-mapped files for zero-copy reads
  • ACID transactions with MVCC; readers and writers never block each other
  • sorted keys for range lookups
  • multiple sub-databases in one environment
  • no logs, compaction or crash recovery to manage
  • about 32 KB of object code

Alternatives

The same job

These do what LMDB does.

  1. sled Pure-Rust embedded key-value database with a BTreeMap-like API and ACID transactions
  2. LevelDB Fast embedded key-value storage library from Google with ordered keys
  3. RocksDB Embeddable persistent key-value store for fast storage
  4. bbolt An embedded key/value database for Go
  5. SQLite Small. Fast. Reliable. Choose any three.
  6. Badger Embeddable, persistent key-value database in pure Go

Compare LMDB with the top 3