-
Notifications
You must be signed in to change notification settings - Fork 415
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
experimental redb database backend support #1045
base: master
Are you sure you want to change the base?
Conversation
redb needs at least rustc 1.66, and the Database trait in the pr uses generic associated types which were stabilized in 1.65 (redb also uses them) |
why not sled? |
stats so far: clearly I am doing something wrong here because redb's performance is comparable to that of rocksdb according to the project maintainer's benchmarks could signet just be the wrong thing to test with? will redb perform better (compared to rocksdb) once rocksdb can't do (almost) everything in ram? |
I initially considered starting with redb or sled, both are in beta, but I chose redb because its file format is stable, contrary to sled which has warnings about possible manual migration in its readme I will try sled right now, hopefully I get it to work with similar performance compared to rocksdb |
fwiw sled claims to be in alpha now |
they name beta in their readme, anyway this should only be an issue if there are bugs in there, and the manual migrations only become an issue when updating sled in the future, if they put a breaking change in a patch version (semver people wont be happy then) we just pin it to a previous (working) patch version |
good news for sled: its minimum rust version is below that of electrs (redb would require a higher one) and I can work around not being able to use generic associated types, there is a workaround for that for old versions of rust |
I hope we don't end up with sled. Manual migration would be very annoying for the users. |
It shouldn't be annoying for electrs users, there is a bit of doc from sled on how to do migration, (import and export functions), in electrs we can make this an automatic migration. I think "manual" refers to users of sled (rust projects that use it as library, like electrs) need to manually add/change code for some updates. |
Still no migration is better than migration which takes time and resources. |
6bbf852
to
b1cfafc
Compare
for the time being i updated the used rust toolchain to 1.65 because generic associated types were needed
for now set as default features set rust version to 1.66 bacuse redb requires that
depends on #1043 because fixed size datatypes made this pr easier
a bit inspired by #765, only not trying to get a dozen DBs to work at once, and not using any dynamic dispatch
still experimental because it performed a bit worse than rocksdb in my initial try (indexing on the signet), but that could be due to other factors as well (both were running from the same bitcoind so one might have gotten prioritized maybe?)
there is a few TODOs still (like metrics from the db) and probably some configuration still needed to get more speed out of the hardware
the
Database
trait defines all things the rest of electrs can do with a database backend, so more databases can be added later, even a built in in-memory db maybe for automated testing or just quick regtest setup