perf(l1): revert optimistic transactions in rocksdb and remove the explicit configured cache#4853
Conversation
Lines of code reportTotal lines added: Detailed view |
|
Here we have some initial measurements for backing the 40~50% of memory reduction mentioned in this PR. We are right now testing it again without Node Memory (RSS) & Host memory in mages
|
There was a problem hiding this comment.
Pull Request Overview
This PR reverts optimistic transactions in RocksDB and removes explicit cache configurations to reduce memory usage by 40-50%. The changes replace OptimisticTransactionDB with standard DBWithThreadMode and remove cache-related options from RocksDB configuration.
- Replace
OptimisticTransactionDBwithDBWithThreadModeacross all RocksDB implementations - Remove explicit cache setup and cache-related block options to reduce memory footprint
- Update batch operations to use standard
WriteBatchinstead ofWriteBatchWithTransaction
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/storage/trie_db/rocksdb_locked.rs | Updated type signatures to use DBWithThreadMode instead of OptimisticTransactionDB |
| crates/storage/trie_db/rocksdb.rs | Replaced optimistic transaction DB with standard DB and updated batch operations |
| crates/storage/store_db/rocksdb.rs | Removed cache configuration and replaced optimistic transactions with standard DB operations |
| CHANGELOG.md | Added entry documenting the memory optimization changes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Benchmark Block Execution Results Comparison Against Main
|
|
After pathbased, this PR doesn't reduce performance as measured before. Right now snapsync takes the same time with and without optimistic transactions. |


Motivation
This PR reduces memory by 40~50%
Description
This PR sits is basically #4839 but instead of starting from #4821 it starts from main, and after different testing scenarios we came up with this cut in memory:
The caveat is that it appears to be 50% slower, we need to make specific measures to validate the results seen in #4839(no longer the case, see #4853 (comment))