From 2d1cd6b083f416f99a84450ac0fba28809f7d911 Mon Sep 17 00:00:00 2001 From: Swanny Date: Thu, 16 Apr 2026 08:41:33 -0400 Subject: [PATCH 1/2] feat(cold): increase LRU cache from 128 to 2048 entries per map 128 entries is too small for RPC workloads where the same recent blocks, transactions, and receipts are queried repeatedly by different concurrent callers, causing unnecessary cold storage round-trips. Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/cold/src/task/cache.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/cold/src/task/cache.rs b/crates/cold/src/task/cache.rs index c047e40..9feb64c 100644 --- a/crates/cold/src/task/cache.rs +++ b/crates/cold/src/task/cache.rs @@ -10,7 +10,10 @@ use signet_storage_types::{RecoveredTx, SealedHeader}; use std::num::NonZeroUsize; /// Default capacity for each LRU cache map. -const DEFAULT_CACHE_CAPACITY: usize = 128; +/// +/// Sized for RPC workloads where the same recent blocks, transactions, +/// and receipts are queried repeatedly by different callers. +const DEFAULT_CACHE_CAPACITY: usize = 2048; /// Evict all entries from an LRU cache whose keys satisfy the predicate. fn evict_where( @@ -34,7 +37,7 @@ pub(crate) struct ColdCache { } impl ColdCache { - /// Create a new cache with the default capacity (128 per map). + /// Create a new cache with the default capacity (2048 per map). pub(crate) fn new() -> Self { Self::new_with_cap(DEFAULT_CACHE_CAPACITY) } From dfa0f4fdbed2c97109caa8e37e796cd4da3e686f Mon Sep 17 00:00:00 2001 From: Swanny Date: Thu, 16 Apr 2026 10:25:52 -0400 Subject: [PATCH 2/2] chore: revert added comment, bump version to 0.7.2 Removes the explanatory comment on DEFAULT_CACHE_CAPACITY per review feedback. Bumps workspace version from 0.7.1 to 0.7.2. Co-Authored-By: Claude Opus 4.6 (1M context) --- Cargo.toml | 16 ++++++++-------- crates/cold/src/task/cache.rs | 3 --- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cc3cd1c..be09d71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["crates/*"] resolver = "2" [workspace.package] -version = "0.7.1" +version = "0.7.2" edition = "2024" rust-version = "1.92" authors = ["init4"] @@ -35,13 +35,13 @@ incremental = false [workspace.dependencies] # internal -signet-hot = { version = "0.7.1", path = "./crates/hot" } -signet-hot-mdbx = { version = "0.7.1", path = "./crates/hot-mdbx" } -signet-cold = { version = "0.7.1", path = "./crates/cold" } -signet-cold-mdbx = { version = "0.7.1", path = "./crates/cold-mdbx" } -signet-cold-sql = { version = "0.7.1", path = "./crates/cold-sql" } -signet-storage = { version = "0.7.1", path = "./crates/storage" } -signet-storage-types = { version = "0.7.1", path = "./crates/types" } +signet-hot = { version = "0.7.2", path = "./crates/hot" } +signet-hot-mdbx = { version = "0.7.2", path = "./crates/hot-mdbx" } +signet-cold = { version = "0.7.2", path = "./crates/cold" } +signet-cold-mdbx = { version = "0.7.2", path = "./crates/cold-mdbx" } +signet-cold-sql = { version = "0.7.2", path = "./crates/cold-sql" } +signet-storage = { version = "0.7.2", path = "./crates/storage" } +signet-storage-types = { version = "0.7.2", path = "./crates/types" } # External, in-house signet-libmdbx = { version = "0.8.0" } diff --git a/crates/cold/src/task/cache.rs b/crates/cold/src/task/cache.rs index 9feb64c..66d6603 100644 --- a/crates/cold/src/task/cache.rs +++ b/crates/cold/src/task/cache.rs @@ -10,9 +10,6 @@ use signet_storage_types::{RecoveredTx, SealedHeader}; use std::num::NonZeroUsize; /// Default capacity for each LRU cache map. -/// -/// Sized for RPC workloads where the same recent blocks, transactions, -/// and receipts are queried repeatedly by different callers. const DEFAULT_CACHE_CAPACITY: usize = 2048; /// Evict all entries from an LRU cache whose keys satisfy the predicate.