Dear all,
I'm searching for a key-value database. I don't need network access, but I would like to access the DB from multiple processes.
LMDB
I have stumbled upon LMDB, which seems to be a lightweight solution with a lot of features that I could use, in particular transaction support and concurrent access from multiple processes. See their homepage.
Using LMDB through the "rkv
" crate in Rust
However, looking for a Rust binding, I saw a warning in the README of the rkv
crate:
Warning
To use rkv in production/release environments at Mozilla, you may do so with the "SafeMode" backend, for example:
[…]
The "SafeMode" backend performs well, with two caveats: the entire database is stored in memory, and write transactions are synchronously written to disk (only on commit).
In the future, it will be advisable to switch to a different backend with better performance guarantees. We're working on either fixing some LMDB crashes, or offering more choices of backend engines (e.g. SQLite).
I tried to do some research what these crashes are about. I found this, but not sure if it is the (only) problem.
Other people seem to be confused about this warning as well; see the following issue in rkv
's bugtracker:
serefarikan commented on Jun 19
I've been looking for a rust binding to LMDB and I thought rkv may be a good candidate given it is under mozilla.
However, the recommendations in the README for production uses are quite conservative (full db in memory and synched transactions) and furthermore, there are references to LMDB crashes to be fixed.
It would be great if the readme provided references to what these crashes are, since that statement made my question my positive view of LMDB's stability.
Given the other projects where LMDB is used, I have a hard time believing this is a problem of LMDB, but I'd rather suspect it's the Rust bindings (rkv
). Does anyone know something about this?
The above issue wasn't commented for over 6 months and there weren't any commits to rkv
's repository within a year.
Other Rust bindings for LMDB
There are some other bindings for LMDB, but their last releases are several years old:
Any crate I could reasonably use or that someone can recommend?
jammdb
I stumbled upon jammdb (mentioned in this post), which started as a port of a database that was inspired by LMDB. But I have no idea if it's suitable for productive use and actively maintained. At least the most recent version is less than a year old.
sled
Searching further, I found sled
mentioned in this post. Checking sled
's repository, there have been commits a couple of months ago. But the database is still considered beta, I guess? In the README as of time of writing this post, the author lists under priorities:
- the 1.0.0 release date is imminent! just putting the final touches on, while performing intensive testing
The README of the latest release said:
- the 1.0.0 release date is January 19, 2021 (sled's 5th birthday)
There's no version 1.0.0 yet, but maybe it's just a tiny bit of waiting? Anyway, as far as I understand, it doesn't seem to support concurrent openings of the database, as the most recent version (in the repository) of the README says:
sled does not support multiple open instances for the time being
I would assume this also means I cannot open the database from several processes at the same time.
What to use?
Which of these (or other) solutions for a lightweight key-value store would/could you recommend?