-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would it be possibe to swap rocksdb for something else? #201
Comments
RocksDB build time is indeed an issue - maybe we can try LMDB?
|
OTOH, there is https://github.com/spacejam/sled which is pure Rust :) |
LMDB sounds good. Sled is beta, so I think we should wait with that. Hopefully I will find some time to contribute a PR until the end of January. |
2021 and sled is still beta Just my two cents, maybe a pluggable datastore API makes sense (if not too much extra work). What are your thoughts? Is anyone currently working on this? |
Compile time is partially solved by dynamic linking (and sufficient for me so far) but having change-able database could still be interesting. It should be possible using Clean Architecture, not sure how much work. |
Not familiar with Clean Architecture (looks it up). SQLite might be another good alternative |
https://crates.io/crates/heed (Rust LMDB/MDBX wrapper) is used by meilisearch/meilisearch#230:
|
http://www.lmdb.tech/bench/microbench/ looks promising :) |
FWIW there are several crates implementing KV storage via LMDB, with different levels of abstraction:
|
Is there any recent update on this? I'd like to use this crate alongside another crate that depends on an incompatible version of rocksdb |
@bukatea it's not simple, so if you're in a hurry you're probably better off resolving the incompatibility. |
@Kixunil thx much, happened to find another solution :) |
https://github.com/cberner/redb can be an option as well. |
I've been using LDMB via https://docs.rs/heed/latest/heed/ for about a year in a nostr client and I'm very happy with it. Heed was recommended to me by Howard Chu the LMDB author as the best rust interface to it. But you should know the downsides. The database doesn't automatically compress itself, and copy on write with multiple transactions can leave data larger than it needs to be. Using the 'mdb_copy -c' command line resolves this, but there is no rust library call to do this compaction (yet, IIRC). Sled always looked like a cool idea for optimizing high-contention situations, but too experimental. I haven't used rocksdb yet so I can't say if LMDB seems better or worse to me. |
FYI since opening this issue I'm less enthusiastic about it. A pure Rust impl would be statically linked which has its own downsides. It's cool how much compile time gets reduced when dynamically linking. (I exclusively link dynamically.) |
Even when linking dynamically, the library still has to be compiled (not talking about downloading precompiled libraries here, you can statically link them too then). When I compile electrs (statically) after a code change, rocksdb and all the other crates wont have to be recompiled, simply because of caching. I do agree that dynamic linking is good for disk usage on a system by not duplicating libraries in every binary (I use Arch Linux myself!). LMDB can be dynamically linked too but LMDB compiles much faster (few seconds!) than RocksDB anyway given the amount of code they each have. |
@antonilol I don't compile rocksdb myself, I use the system one. And caching doesn't help when doing Debian packages with deterministic compilation since it's best to build them from scratch to avoid any surprises. |
https://github.com/fjall-rs/fjall can be also interesting to try:
|
I will add fjall to #1045 and compare them to the other databases already in there. |
I found that it takes enormous time to build and strangely, it's now taking me several hours.
It'd be nice if it could be swapped for something else somehow. Even if its slightly slower.
The text was updated successfully, but these errors were encountered: