Skip to content

Commit 27be096

Browse files
perf(l1)!: enable BlobDB for account bytecodes (#5300)
**Motivation** <!-- Why does this pull request exist? What are its goals? --> **Description** This PR changes the account_codes CF to use RocksDB [BlobDB functionality](https://github.com/facebook/rocksdb/wiki/BlobDB), which moves values outside from the tree, to independent files. We expect this to increase the read performance, since bytecodes can have vastly different sizes, and some occupy multiple page lines. --------- Co-authored-by: Javier Chatruc <[email protected]> Co-authored-by: Javier Rodríguez Chatruc <[email protected]>
1 parent 4b48335 commit 27be096

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Perf
44

5+
### 2025-11-13
6+
7+
- Use BlobDB for account_codes column family [#5300](https://github.com/lambdaclass/ethrex/pull/5300)
8+
59
### 2025-11-12
610

711
- Only mark individual values as dirty instead of the whole trie [#5282](https://github.com/lambdaclass/ethrex/pull/5282)

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ uuid = { version = "1.18.1", features = ["v4"] }
118118
tower-http = { version = "0.6.2", features = ["cors"] }
119119
indexmap = { version = "2.11.4" }
120120

121-
rocksdb = { version="0.24.0", default-features = false, features = ["bindgen-runtime"] }
121+
rocksdb = { version = "0.24.0", default-features = false, features = [
122+
"bindgen-runtime",
123+
"lz4",
124+
] }
122125

123126
[patch.crates-io]
124127
secp256k1 = { git = "https://github.com/sp1-patches/rust-secp256k1", tag = "patch-0.30.0-sp1-5.0.0" }

crates/storage/store_db/rocksdb.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,21 @@ impl Store {
302302
block_opts.set_bloom_filter(10.0, false); // 10 bits per key
303303
cf_opts.set_block_based_table_factory(&block_opts);
304304
}
305-
CF_RECEIPTS | CF_ACCOUNT_CODES => {
305+
CF_ACCOUNT_CODES => {
306+
cf_opts.set_write_buffer_size(128 * 1024 * 1024); // 128MB
307+
cf_opts.set_max_write_buffer_number(3);
308+
cf_opts.set_target_file_size_base(256 * 1024 * 1024); // 256MB
309+
310+
cf_opts.set_enable_blob_files(true);
311+
// Small bytecodes should go inline (mainly for delegation indicators)
312+
cf_opts.set_min_blob_size(32);
313+
cf_opts.set_blob_compression_type(rocksdb::DBCompressionType::Lz4);
314+
315+
let mut block_opts = BlockBasedOptions::default();
316+
block_opts.set_block_size(32 * 1024); // 32KB
317+
cf_opts.set_block_based_table_factory(&block_opts);
318+
}
319+
CF_RECEIPTS => {
306320
cf_opts.set_write_buffer_size(128 * 1024 * 1024); // 128MB
307321
cf_opts.set_max_write_buffer_number(3);
308322
cf_opts.set_target_file_size_base(256 * 1024 * 1024); // 256MB

0 commit comments

Comments
 (0)