Skip to content

feat(cold): increase LRU cache from 128 to 2048 entries#55

Merged
rswanson merged 2 commits intomainfrom
feat/increase-cold-cache-size
Apr 16, 2026
Merged

feat(cold): increase LRU cache from 128 to 2048 entries#55
rswanson merged 2 commits intomainfrom
feat/increase-cold-cache-size

Conversation

@rswanson
Copy link
Copy Markdown
Member

Summary

  • Increase DEFAULT_CACHE_CAPACITY from 128 to 2048 entries per map (headers, transactions, receipts)
  • 128 entries evicts too aggressively under moderate RPC load, causing unnecessary database round-trips for recently queried items

Context

The cold storage task allows up to 64 concurrent readers, all of which populate and read from a shared LRU cache. At 128 entries, the cache thrashes under typical RPC workloads where multiple callers request overlapping blocks/transactions, defeating the purpose of the cache layer.

2048 entries covers roughly the last ~2048 blocks of headers and the most active transactions/receipts, which is a reasonable working set for an RPC endpoint.

Test plan

  • cargo +nightly fmt -- --check
  • cargo clippy -p signet-cold --all-targets
  • cargo t -p signet-cold

🤖 Generated with Claude Code

@rswanson
Copy link
Copy Markdown
Member Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

Copy link
Copy Markdown
Member

@prestwich prestwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add patch version bump on this pr

Comment thread crates/cold/src/task/cache.rs Outdated
rswanson and others added 2 commits April 16, 2026 10:24
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) <noreply@anthropic.com>
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) <noreply@anthropic.com>
@rswanson rswanson force-pushed the feat/increase-cold-cache-size branch from d1f5ca5 to dfa0f4f Compare April 16, 2026 14:26
@rswanson rswanson merged commit bd6e69a into main Apr 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants