Skip to content
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

Add compaction to lmdb_benchmark #853

Merged
merged 1 commit into from
Aug 28, 2024
Merged

Add compaction to lmdb_benchmark #853

merged 1 commit into from
Aug 28, 2024

Conversation

cberner
Copy link
Owner

@cberner cberner commented Aug 28, 2024

Note: compact() is currently too slow to practically run with the default 1M elements. It takes 43secs on my computer when set to 1000 elements

Note: compact() is currently too slow to practically run with the
default 1M elements. It takes 43secs on my computer when set to 1000
elements
@cberner cberner merged commit 39c41aa into master Aug 28, 2024
3 checks passed
@cberner cberner deleted the compaction_bench branch August 28, 2024 03:51
@Kerollmops
Copy link
Contributor

Kerollmops commented Dec 26, 2024

Hey 👋

As I understand correctly, you are compacting the redb database but not the other databases just before measuring the disk size?

It feel unfair to me. Doesn't RocksDB and Sled support compaction, too?

This kind of benchmark is only ran once every now and then, right? Can't we display the very long compaction time of LMDB (and others) with the associated size. Another solution could be to display both, before and after compaction.

Have a nice end of the year 🎄

EDIT: Only redb, RocksDB and LMDB support compactions.

@cberner
Copy link
Owner Author

cberner commented Dec 26, 2024 via email

@Kerollmops
Copy link
Contributor

For sure 😌

You can use the heed Env::copy_to_file/fd method to write the content of the database into another file or fd. Note that you then need to reopen the destination file to read the content and, probably open it with the NO_SUB_DIR option.

When it comes to RocksDB, calling the DBCommon::compact_range/_opt method on every database should be enough to compact everything. I don't know if it is blocking but you should be able to decide about that with some options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants