Hi! I’m Bernard, the creator of Lunatic.
Thanks you @AstonJ for sharing our project.
I think @mindriot pretty much nailed the core idea behind it.
It doesn’t need to be just “loads of tiny WASM” things, it can only be one WASM module that spawns processes from functions defined inside it. Lunatic should be usable for small projects to really big one. I love using it myself to play around with small side projects.
Lunatic can offer a bit more powerful per process isolation than you get on the BEAM. E.g:
- You can spawn a process that can only use a limited amount of memory or CPU.
- You can use C bindings without fear. Once everything is compiled to WebAssembly, long running code will still be preempted and crashes don’t escape the process boundary.
- You can limit syscalls on a per process level, e.g. spawn this process but don’t let any code running in it open a network connection.
- Redirect syscallls, e.g. if this process writes to a log file redirect the stream over the network to an Elastic cluster.
- You can use it from you favourite language if it compiles to WebAssembly. Currently we only provide libraries for Rust and AssemblyScript.
A long term goal of the project is to be able to take some codebase, let’s say a C project, recompile it to WebAssembly and run it on top of Lunatic. If you use threads in your project, we abstract them with much more lightweight processes that share memory. If you do a blocking network read, we just take this thread off the executor until the data arrives. We want to bring as many benefits of Erlang to other languages with the least amount of work required from the developer and stay close to the existing APIs of each language.
If anyone has some questions, I would be happy to answer them.