You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 14, 2025. It is now read-only.
In src/wasm_runner.rs the prepare_wasm_instance() will create and instantiated linker for every request, it will consume about 80% CPU time during stress testing.
pub fn prepare_wasm_instance(
ctx: WasiCtx,
wasm_module: &WasmModuleSource,
link_options: WasmLinkOptions,
) -> Result<(Store<WasiCtx>, Instance), Error> {
debug!("Cloning module object");
let (module, engine) = wasm_module.get_compiled_module()?;
let mut store = new_store(ctx, &engine)?;
debug!("Configuring linker");
let mut linker = Linker::new(&engine);
wasmtime_wasi::add_to_linker(&mut linker, |cx| cx)?;
link_options.apply_to(&mut linker)?;
debug!("instantiating module in linker");
let instance = linker.instantiate(&mut store, &module)?;
Ok((store, instance))
}
The profiling result is enclosed
I create a quick prototype to cache the linker for each compiled wasm module, the cold start time is reduced a lot. The profiling result after optimization is enclosed. it will only consume about 18% CPU time.
Just want to know your suggestion for that. Thanks