diff --git a/CHANGELOG.md b/CHANGELOG.md index 0097fb829b..a5388cc089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changes - Optimization of mutex usage in cache for reaper [#3286](https://github.com/evstack/ev-node/pull/3286) +- Reduce tx cache retention to avoid OOM under (really) heavy tx load [#3299](https://github.com/evstack/ev-node/pull/3299) ## v1.1.1 diff --git a/block/internal/cache/manager.go b/block/internal/cache/manager.go index e907002600..4d95a7d7e5 100644 --- a/block/internal/cache/manager.go +++ b/block/internal/cache/manager.go @@ -26,7 +26,8 @@ const ( DataDAIncludedPrefix = "cache/data-da-included/" // DefaultTxCacheRetention is the default time to keep transaction hashes in cache. - DefaultTxCacheRetention = 24 * time.Hour + // Keeping a too high value can lead to OOM during heavy transaction load. + DefaultTxCacheRetention = 30 * time.Minute ) // CacheManager provides thread-safe cache operations for tracking seen blocks diff --git a/block/internal/reaping/reaper.go b/block/internal/reaping/reaper.go index d35dbfff3e..1f51c08f10 100644 --- a/block/internal/reaping/reaper.go +++ b/block/internal/reaping/reaper.go @@ -21,7 +21,10 @@ import ( const ( // MaxBackoffInterval is the maximum backoff interval for retries MaxBackoffInterval = 30 * time.Second - CleanupInterval = 1 * time.Hour + + // CleanupInterval is how often the reaper sweeps expired hashes + // out of the seen-tx cache. + CleanupInterval = max(cache.DefaultTxCacheRetention/10, 15*time.Second) ) // Reaper is responsible for periodically retrieving transactions from the executor,