Hi everyone. I've updated wasmtime from v27 to v40 aiming to call component functions concurrently (as part of the same Store instance, with dynamically linked components). e.g. say I have WASI CLI A and WASI CLI B and want to run both components concurrently that share the same store and can also communicate between each other.
I'm trying to implement Func::call_concurrent -- does anyone know if there are any examples for this? I'm not sure if it's possible to do what I'm thinking, perhaps I'd need multiple Stores and to manage the data replication from the host?
Most examples at this time will be throughout Wasmtime's test suite, we don't have dedicated examples for this just yet.
You'll be able to use one store and you'll be using run_concurrent to get an Accessor which from there you can call call_concurrent
I see. That sounds good, thanks!
I've tried a few different things so far but I only see the components running serially rather than concurrently. It just picks one of 2 components and runs that indefinitely.
Here's the example component. I'm running two instances of this to test concurrency.
image.png
So I'd expect to see 2 different program numbers appearing in stdout every second. But only one component is running.
I've tried different ways to join the tasks, for example like below taken from wasmtime tests.
Do I have the wrong idea here, Is it not possible to run 2 CLI programs in WASI concurrently? or am I just doing it wrong?
You're running into this clause of the documentation which is that using tokio in the guest induces "store blocking behavior" which means concurrency doesn't work inside of run_concurrent
Unfortunately there's no great solution for that at this time, it's one that we need to work on within Wasmtime itself
Oh ok. Thanks for letting me know! Looks like the fix is planned to be included with wasip3, is that right? I'd be happy to help with implementing this.
Hey just wanted to note @Lorenzo , a doc comment would probably be appreciated if you were willing to contribute one in the meantime!
If you went to the rust docs and would have benefitted from seeing a guide to how to use call_concurrent maybe some docs near there would be useful?
Opened here https://github.com/bytecodealliance/wasmtime/pull/12330 :)
Amazing job @Lorenzo Fontoura!
Last updated: Feb 24 2026 at 04:36 UTC