diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e7269387f8..0fb72557f80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Perf +### 2025-11-10 +- Disable RocksDB compression [#5223](https://github.com/lambdaclass/ethrex/pull/5223) + ### 2025-11-07 - Reuse stack pool in LEVM [#5179](https://github.com/lambdaclass/ethrex/pull/5179) diff --git a/Cargo.lock b/Cargo.lock index 9812ca093ff..aad79076d67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5704,8 +5704,6 @@ dependencies = [ "cc", "libc", "libz-sys", - "lz4-sys", - "zstd-sys", ] [[package]] @@ -5934,16 +5932,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" -[[package]] -name = "lz4-sys" -version = "1.11.1+lz4-1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "malachite" version = "0.4.22" diff --git a/Cargo.toml b/Cargo.toml index 7fba81ef907..2a250fa1caa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -119,7 +119,7 @@ uuid = { version = "1.18.1", features = ["v4"] } tower-http = { version = "0.6.2", features = ["cors"] } indexmap = { version = "2.11.4" } -rocksdb = "0.24.0" +rocksdb = { version="0.24.0", default-features = false, features = ["bindgen-runtime"] } [patch.crates-io] secp256k1 = { git = "https://github.com/sp1-patches/rust-secp256k1", tag = "patch-0.30.0-sp1-5.0.0" } diff --git a/crates/storage/store_db/rocksdb.rs b/crates/storage/store_db/rocksdb.rs index a49bf7c270e..a7a23c047ef 100644 --- a/crates/storage/store_db/rocksdb.rs +++ b/crates/storage/store_db/rocksdb.rs @@ -180,6 +180,8 @@ impl Store { db_options.set_enable_write_thread_adaptive_yield(true); db_options.set_compaction_readahead_size(4 * 1024 * 1024); // 4MB db_options.set_advise_random_on_open(false); + db_options.set_compression_type(rocksdb::DBCompressionType::None); + db_options.set_bottommost_compression_type(rocksdb::DBCompressionType::None); // db_options.enable_statistics(); // db_options.set_stats_dump_period_sec(600); @@ -239,10 +241,10 @@ impl Store { cf_opts.set_level_zero_file_num_compaction_trigger(4); cf_opts.set_level_zero_slowdown_writes_trigger(20); cf_opts.set_level_zero_stop_writes_trigger(36); + cf_opts.set_compression_type(rocksdb::DBCompressionType::None); match cf_name.as_str() { CF_HEADERS | CF_BODIES => { - cf_opts.set_compression_type(rocksdb::DBCompressionType::Zstd); cf_opts.set_write_buffer_size(128 * 1024 * 1024); // 128MB cf_opts.set_max_write_buffer_number(4); cf_opts.set_target_file_size_base(256 * 1024 * 1024); // 256MB @@ -252,7 +254,6 @@ impl Store { cf_opts.set_block_based_table_factory(&block_opts); } CF_CANONICAL_BLOCK_HASHES | CF_BLOCK_NUMBERS => { - cf_opts.set_compression_type(rocksdb::DBCompressionType::Lz4); cf_opts.set_write_buffer_size(64 * 1024 * 1024); // 64MB cf_opts.set_max_write_buffer_number(3); cf_opts.set_target_file_size_base(128 * 1024 * 1024); // 128MB @@ -263,7 +264,18 @@ impl Store { cf_opts.set_block_based_table_factory(&block_opts); } CF_TRIE_NODES => { - cf_opts.set_compression_type(rocksdb::DBCompressionType::Lz4); + cf_opts.set_write_buffer_size(512 * 1024 * 1024); // 512MB + cf_opts.set_max_write_buffer_number(6); + cf_opts.set_min_write_buffer_number_to_merge(2); + cf_opts.set_target_file_size_base(256 * 1024 * 1024); // 256MB + cf_opts.set_memtable_prefix_bloom_ratio(0.2); // Bloom filter + + let mut block_opts = BlockBasedOptions::default(); + block_opts.set_block_size(16 * 1024); // 16KB + block_opts.set_bloom_filter(10.0, false); // 10 bits per key + cf_opts.set_block_based_table_factory(&block_opts); + } + CF_FLATKEYVALUE => { cf_opts.set_write_buffer_size(512 * 1024 * 1024); // 512MB cf_opts.set_max_write_buffer_number(6); cf_opts.set_min_write_buffer_number_to_merge(2); @@ -276,7 +288,6 @@ impl Store { cf_opts.set_block_based_table_factory(&block_opts); } CF_RECEIPTS | CF_ACCOUNT_CODES => { - cf_opts.set_compression_type(rocksdb::DBCompressionType::Lz4); cf_opts.set_write_buffer_size(128 * 1024 * 1024); // 128MB cf_opts.set_max_write_buffer_number(3); cf_opts.set_target_file_size_base(256 * 1024 * 1024); // 256MB @@ -287,7 +298,6 @@ impl Store { } _ => { // Default for other CFs - cf_opts.set_compression_type(rocksdb::DBCompressionType::Lz4); cf_opts.set_write_buffer_size(64 * 1024 * 1024); // 64MB cf_opts.set_max_write_buffer_number(3); cf_opts.set_target_file_size_base(128 * 1024 * 1024); // 128MB