Repository navigation
Conversation
Add DISABLED_RPC_CACHES (--disabled-rpc-caches), a comma-separated list of the RpcCache response caches to turn off: contract_storage, protocol_state, protocol_components, traced_entry_points. A disabled cache runs the fallback on every call and stores nothing. All caches stay on by default. Blank entries are ignored so an empty env value keeps every cache on; unknown names fail startup. Lets dev measure whether the response caches still earn their memory next to the entity cache and the storage token cache before any of them is removed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
# Conflicts: # crates/tycho-indexer/src/cli.rs # crates/tycho-indexer/src/main.rs
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
DISABLED_RPC_CACHES(--disabled-rpc-caches) turns off any of the fourRpcCacheresponse caches in the RPC handler:contract_storage,protocol_state,protocol_components,traced_entry_points. Comma-separated. An unknown name fails startup with the list of valid names; blank entries are ignored, soDISABLED_RPC_CACHES=""keeps everything on. All caches stay on by default, so nothing changes for existing deployments.A disabled cache runs the fallback on every call and stores nothing, so no placeholder, no in-flight coalescing, no
rpc_cache_*metrics for that cache. Theindexandrpccommands both honour the flag. Startup logsRPC response caches turned offwith the list.Why
To measure in dev whether the response caches still earn their memory now that the entity cache, the storage token cache and the delta windows exist.
Today they are still the only response caching prod has:
ENTITY_CACHE_MODEisshadowon every dev chain and unset in prod, and the component index (#1559) is not merged. Prod hit rates over the last 7 days (VictoriaMetrics,rpc_cache_hits/rpc_cache_misses,prod-tycho+prod-tycho-fynd):protocol_componentscontract_storageserve(ids in window)protocol_stateserve(ids in window)traced_entry_pointstraced_entry_pointsis the obvious first candidate: under 3% hits while holding 150 MB on the ethereum pods.contract_storagecosts about 1 GB per ethereum pod for a one-in-three hit; withENTITY_CACHE_MODE=servethe same requests are answered from memory anyway, so it can go once serve is on.protocol_componentsandprotocol_statestill pay for themselves on base, bsc and the fynd instances (up to 81% hits) and should stay until their replacements land.Not in this PR: removing any cache. That is the follow-up once dev confirms it.
How to test in dev
Set on a dev chain that already runs
ENTITY_CACHE_MODE=shadoworserve:Then compare
rpc_request_duration_secondsper endpoint and database load against a chain that keeps the caches on, and checkrpc_cache_weighted_sizedrops for the disabled names.Tests
services::cache: a disabled cache runs the fallback on everygetand keeps zero entries.services::rpc: a handler withprotocol_componentsdisabled sends two identical requests to the gateway.cli: parses one, two, empty and blank-padded lists; rejects an unknown cache name. Existing arg-parsing fixtures updated. Verified theclitests also pass withDISABLED_RPC_CACHES=(empty) exported, which a plainclapvalue enum rejected.🤖 Generated with Claude Code