Skip to content

Commit 04e4dfb

Browse files
committed
fix(node): raise default runtime-cache-size to 8 (upstream default 2 thrashes WASM cache on archive/RPC nodes)
1 parent d156858 commit 04e4dfb

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

node/src/service.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)