Skip to content

Conversation

marvin-j97
Copy link
Contributor

!!! I haven't benchmarked this !!!

This is mostly a configuration based on intuition because I don't know what data is stored exactly in each CF and what access pattern it has.

bopts.set_cache_index_and_filter_blocks(true);
bopts.set_pin_l0_filter_and_index_blocks_in_cache(true);
bopts.set_bloom_filter(10.0, false);
bopts.set_checksum_type(rocksdb::ChecksumType::XXH3);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default is CRC32; XXH3 is much faster. Considering constellation is probably IO-bound (on the RasPi), most block reads come from the OS page cache or disk directly, so each block read will incur a checksum calculation.

bopts.set_checksum_type(rocksdb::ChecksumType::XXH3);
opts.set_block_based_table_factory(&bopts);

opts.set_min_level_to_compress(1);
Copy link
Contributor Author

@marvin-j97 marvin-j97 Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constellation has a very steady input of new data, so we know L0 is short-lived. L0 tends to store <= 256 MB data, so not much space savings here, so disabling compression reduces CPU spent when reading from L0.
Could be expanded to L1 maybe.

Comment on lines +303 to +305
bopts.set_pin_top_level_index_and_filter(true);
bopts.set_index_type(rocksdb::BlockBasedIndexType::TwoLevelIndexSearch);
bopts.set_partition_filters(true);
Copy link
Contributor Author

@marvin-j97 marvin-j97 Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope my intuition was right and TARGET_LINKERS_CF is the largest CF. The idea is to reduce cache movement when paging in and out the index/filter blocks.

);

let mut bopts = rocksdb::BlockBasedOptions::default();
// bopts.set_block_size(/* 16 KiB */ 16 * 1_024);
Copy link
Contributor Author

@marvin-j97 marvin-j97 Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increasing block size may decrease space usage, but it really depends on the data that is stored in each CF. Prefix truncation already takes care of shortening keys to some degree, so if the values are not that compressible, the space savings may be subpar.

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.

1 participant