File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,12 +166,23 @@ pub fn new_partial(
166166 extra_pages : h as _ ,
167167 } ) ;
168168
169+ // The upstream default runtime cache size (2) is too small for nodes that serve
170+ // historical state across runtime upgrades: the hot working set spans several
171+ // runtime versions, so a cache of 2 evicts and re-prepares WASM runtimes
172+ // constantly and exhausts the instance pool under indexer/RPC load. Treat the
173+ // upstream default as "unset" and use 8; honor any explicit operator value.
174+ let runtime_cache_size = if config. executor . runtime_cache_size == 2 {
175+ 8
176+ } else {
177+ config. executor . runtime_cache_size
178+ } ;
179+
169180 let executor = WasmExecutor :: builder ( )
170181 . with_execution_method ( config. executor . wasm_method )
171182 . with_onchain_heap_alloc_strategy ( heap_pages)
172183 . with_offchain_heap_alloc_strategy ( heap_pages)
173184 . with_max_runtime_instances ( config. executor . max_runtime_instances )
174- . with_runtime_cache_size ( config . executor . runtime_cache_size )
185+ . with_runtime_cache_size ( runtime_cache_size)
175186 . build ( ) ;
176187
177188 let tx_priority_json = if no_tx_priority_override {
You can’t perform that action at this time.
0 commit comments