AstonJ

AstonJ

Lunatic - An Erlang inspired runtime for all programming languages (WebAssembly)

More cool tech inspired by erlang :nerd_face:

By combining the fault-tolerance and massive concurrency of Erlang with the capability-based security of WebAssembly, it creates a powerful programming model.

Architecture

Lunatic is a single executable and runs on Windows, macOS and Linux. It spawns lightweight processes from WebAssembly modules that have their own heap/stack. These processes are preemptively scheduled on a multi-threaded executor.

Processes

Lunatic’s design is all about super lightweight processes. Processes are fast to create, have a small memory footprint and a low scheduling overhead. They are designed for massive concurrency.

Isolation

Lunatic sits between your operating system and the running processes. This allows it to decide on a per process basis what syscalls are going to be forwarded to the operating systems.

If you would like to run some untrusted code, you can. Just spawn it inside of a process without any privileges.

19 2058 9

Most Liked

mindriot

mindriot

This looks pretty interesting and I’ve not fully got my head into the details yet however I think you have possibly put this into the wrong category. The first thought I got from the first few paragraphs was this was looking like something in the realm of Lumen but taking inspiration from BEAM / Erlang rather than implementing it. It seems however it is a server side thing.

From the FAQ page:

What is Lunatic?
Lunatic is a universal runtime for fast, robust, and scalable server-side applications. It’s inspired by Erlang and can be used from any language that compiles to WebAssembly.

From what I can wrap my head around this seems to be an Erlang inspired web assembly runtime environment allowing people to run web assembly modules of some kind as something similar to processes. It claims to do many of the core things like isolation, own stack/heap, inter process messaging, pre-emptive scheduling, super light processes, big concurrency… but the processes themselves execute WASM and it seems like runtime features are surfaced through libraries. I think the idea is building backends from loads of tiny WASM things that live in and talk to each other on a BEAM like runtime layer.

bkolobara

bkolobara

Creator of Lunatic

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:

  1. You can spawn a process that can only use a limited amount of memory or CPU.
  2. 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.
  3. 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.
  4. Redirect syscallls, e.g. if this process writes to a log file redirect the stream over the network to an Elastic cluster.
  5. 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.

dimitarvp

dimitarvp

So glad having you here!

One starting question from my side would be: do you have any testing harness in place that confirms that Lunatic has the runtime guarantees that the OTP has?

I am really loving Elixir and the BEAM but speed and efficiency can be a concern. If we get to a point where a Rust levels of performance runtime exists with all OTP guarantees then I’ll be an immediate convert.

Where Next?

Popular Backend topics Top

First poster: bot
Spring v5.1.20.RELEASE, v5.2.12.RELEASE and v5.3.2 has been released. Link: Release v5.1.20.RELEASE · spring-projects/spring-framework ...
0 1217 0
New
AstonJ
More cool tech inspired by <span class="hashtag-icon-placeholder"></span>erlang :nerd_face: By combining the fault-tolerance and massiv...
19 2058 9
New
First poster: bot
Julia v1.5.4 has been released. Link: Release v1.5.4 · JuliaLang/julia · GitHub
0 1430 0
New
First poster: bot
A new Lunatic blog post/announcement has been posted! Get the full details here: https://lunatic.solutions/lunatic-chat/
0 1199 0
New
First poster: bot
A new Ruby blog post/announcement has been posted! Get the full details here: CVE-2021-28965: XML round-trip vulnerability in REXML
0 1122 0
New
First poster: bot
Spring v6.0.0-M1 has been released. Link: Release v6.0.0-M1 · spring-projects/spring-framework · GitHub
0 1418 0
New
First poster: bot
Julia v1.8.0-beta1 has been released. Link: Release v1.8.0-beta1 · JuliaLang/julia · GitHub
0 1198 0
New
First poster: bot
Node.js v18.16.0 has been released. Link: Release 2023-04-12, Version 18.16.0 'Hydrogen' (LTS), @danielleadams · nodejs/node · GitHub
0 1322 0
New
NewsBot
A new Go blog post/announcement has been posted! Get the full details here: Traversal-resistant file APIs - The Go Programming Language
0 220 0
New
NewsBot
Quarkus 3.21.0.CR1, 3.20.0.CR1 and 3.19.3 has been released. Link: Release 3.21.0.CR1 · quarkusio/quarkus · GitHub Link: Release 3.20...
0 227 0
New

Other popular topics Top

New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
15 8183 19
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
14 6073 7
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
34 3841 21
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
190 3839 79
New
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
8 3528 3
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
0 2920 0
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
0 2183 2
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
0 3570 1
New