Exploring LMDB

17 January 2017

This week I'm continuing my tour of interesting C libraries by writing a Scheme binding to OpenLDAP's Lightning Memory-mapped Database (LMDB). Here's a quick overview of LMDB, and a few things I liked about it.

What is LMDB?

LMDB is a key-value store written by Howard Chu for the OpenLDAP project. LDAP workloads are usually very read-heavy, so the design of LMDB is read-optimised (rather than write-optimised). Depending on your workloads and the shape of your data, you might want to use this as an alternative to LevelDB, TokyoCabinet, BerkleyDB or other embedded key-value stores.

What I liked

Oddities

Disclaimer

I've only written some Scheme bindings and toy programs, and these are my notes so far. All I'm saying is that LMDB has some interesting characteristics, and maybe you should consider it's suitability for your own project. Note a distinct lack of benchmarks on this page. They would be pointless coming from me.

Bindings as exploration

I've written several CHICKEN Scheme bindings now (LevelDB, CommonMark, WiringPi, plus others yet to be released) and I cannot recommend it enough. It's a fun way to explore interesting open-source projects (including all the nooks and crannies of the API), and learn about the language you use at the same time (FFI's are where many programmers first meet language internals). All while producing something for useful your community, which is relatively small, and achievable in a few evenings. Give it a try!

References