← 返回日报
略读 预计 2 分钟

Lunatic: An Erlang-inspired runtime for WebAssembly

摘要

Lunatic 是受 Erlang 启发的 WebAssembly 运行时,提供隔离的轻量级进程支持海量并发与故障容错;节点间可通过 QUIC + mTLS 安全连接,单命令加入新节点。每个进程有独立堆栈、堆和 syscall,若进程失败不会影响其他。支持 C 代码直接调用(无权限的进程隔离漏洞),并可精细控制资源访问。所有 Wasm 可编译代码均可运行,异步编程模式下进程抢占式调度保证线程不被阻塞。开源(Apache / MIT 双许可),可编译一次运行于不同架构与操作系统。

荐读理由

这是一款 Erlang 启发的 Wasm 运行时,专为分布式服务提供隔离进程、QUIC+mTLS 节点间安全连接和监督树式容错。异步预emptive 调度 + per-process syscall 限制,能让 C 代码直接编译进 Wasm 且只影响单个进程。适合大规模并发高吞吐服务,但作为一篇 2026 年 7 月的新项目介绍,尚未有真实案例或生产数据证明迁移价值,属于间接提炼的工程架构

原文

Create distributed services with ease

Lunatic is a WebAssembly runtime inspired by Erlang. It provides isolated, lightweight processes for massive concurrency and fault tolerance. Easily create distributed clusters with secure connections between nodes.

Get started

Features

lunatic-logo-moonOpen-Source

Lunatic is developed under dual Apache/MIT license. Join our growing community and contribute to the project.

lunatic-logo-moonPerformance

Write performant high-throughput, low-latency services. Lunatic leverages the performance of JIT compiled Wasm.

lunatic-logo-moonSecurity

Wasm was designed to run in untrusted environments. Limit each process capabilities using the Lunatic API.

lunatic-logo-moonFault-Tolerance

Monitor failing processes by creating supervision trees inspired by Erlang.

lunatic-logo-moonPortable

Compile once to WebAssembly and run on different architectures and operating systems.

lunatic-logo-moonDistributed

Easily create a securely connected cluster of Lunatic nodes.

Distributed

Lunatic nodes are connected via QUIC and authenticated with mTLS. Join a new node with a single command.

Find out more

Illustration showing various geometric shapes connected

FAQ

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.

Erlang is a programming language and platform developed by Ericsson. It's used to build massively scalable and highly available real-time systems. Almost all Internet traffic is going through routers and switches controlled by Erlang. The technology allowed WhatsApp to scale to 1B users with just a handful of engineers.

WebAssebmly was initially developed to run in the browser and provides extremely strong sandboxing on multiple levels. Lunatic's processes inherit this property.

Each process has its own stack, heap, and even syscalls. If one process fails, it will not affect the rest of the system. This allows you to create very powerful and fault-tolerant abstraction.

This is also true for some other runtimes, but Lunatic goes one step further and makes it possible to use C bindings directly in your app without any fear. If the C code contains any security vulnerabilities or crashes, those issues will only affect the process currently executing the code. The only requirement is that the C code can be compiled to WebAssembly.

It's possible to give per process fine-grained access to resources (filesystem, memory, network connections, etc.). This is enforced on the syscall level. If you are unsure about one of your dependencies' security, you can call it from a process without any permissions and completely isolate it.

All code running on Lunatic is by default async. Processes are scheduled by a work-stealing executor on worker threads. If one of the processes is waiting on I/O or other events, it will be moved off the worker thread until the data is ready. You can write your code in a linear/blocking manner, but Lunatic will make sure it never blocks while waiting.

Lunatic gives you some other properties that can't be easily achieved with async code. Processes are preemptively scheduled and if one process decides to go rogue by hitting an unexpected code path, it will never permanently block the thread and the rest of the system will stay responsive.

All languages that can be compiled to WebAssembly (Wasm) can be run on Lunatic.

Bernard was originally working on a programming language that compiled to Lua, so he named it Lunatic. Later he decided to write a runtime for the language and called it Lunatic VM. We ended up with an actor-based language-agnostic runtime, but the original name was kept though it does not have any connections to Lua anymore.

Let`s connect

Join our community

github-icondiscord-icontwitter-icon

Newsletter

Hacker News · 5 赞 · 1 评 讨论 → 阅读原文 →

这条对你有帮助吗?