Closed munjalpatel closed 5 months ago
I think #6 and #7 has the answers I need. Not sure if you want to provide any additional comment / context @tessi
ha! hey @munjalpatel 👋
you already found the good answers for actual function calls into WASM. There is other things (like compiling a WASM module) which is still sync and uses a "dirty CPU scheduler" in the NIF function. Not ideal and we're planning a bigger refactoring to make all things async long term. But for now, compilation and instantiation aren't usually bottlenecks and those things that are bottlenecks (function calls) are already async.
Hope this give you some more context :)
@tessi tbh, I think use of DirtyCPU
for module compilation is fair given one-time cost -- provided there is an easy mechanism to preserve compiled / initialized modules to the disk or in memory. Which I believe we have (correct me if wrong)!
Hey @tessi amazing work!
Erlang scheduler generally doesn't like long-running processes. For native Erlang / Elixir processes, it uses reductions to preempt so that other processes have fair chance of CPU slice.
How would the scheduler react to WASM running through Rustler? What advise do you have when someone needs to run potentially long-running WASM modules?