From 33ea2523b7272497ba89b79fc38935ac4aa78f27 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 11 May 2023 20:00:40 +0200 Subject: [PATCH] chore: bump cache sizes (#2639) --- crates/rpc/rpc/src/eth/cache.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/rpc/rpc/src/eth/cache.rs b/crates/rpc/rpc/src/eth/cache.rs index 8a44169909..2b3f21a16d 100644 --- a/crates/rpc/rpc/src/eth/cache.rs +++ b/crates/rpc/rpc/src/eth/cache.rs @@ -21,6 +21,14 @@ use tokio::sync::{ }; use tokio_stream::wrappers::UnboundedReceiverStream; +/// Default cache size for the block cache: 500MB +/// +/// With an average block size of ~100kb this should be able to cache ~5000 blocks. +const DEFAULT_BLOCK_CACHE_SIZE_BYTES: usize = 500 * 1024 * 1024; + +/// Default cache size for the receipts cache: 500MB +const DEFAULT_RECEIPT_CACHE_SIZE_BYTES: usize = 500 * 1024 * 1024; + /// The type that can send the response to a requested [Block] type BlockResponseSender = oneshot::Sender>>; @@ -50,24 +58,24 @@ type EnvLruCache = MultiConsumerLruCache Self { Self { - max_block_bytes: 50 * 1024 * 1024, - max_receipt_bytes: 50 * 1024 * 1024, - max_env_bytes: 500 * 1024, + max_block_bytes: DEFAULT_BLOCK_CACHE_SIZE_BYTES, + max_receipt_bytes: DEFAULT_RECEIPT_CACHE_SIZE_BYTES, + max_env_bytes: 1024 * 1024, } } }