Why MLambda
MLambda Actors brings Erlang/OTP’s distribution model to Aleph: a virtual peer-to-peer mesh where actors talk across a self-healing cluster without managing connections, discovering endpoints, or knowing where anything lives. It compiles to native code, so a service is one small static executable.
The virtual P2P mesh
Most actor systems choose between two options:
Direct P2P: actors connect to each other. Fast, but connections multiply with the actors, and when an actor moves or a node dies, everything talking to it must rediscover and reconnect.
Broker: everything goes through a central hub. Simple, but the hub is a bottleneck and a single point of failure.
MLambda takes a third path. Cluster nodes form a gossip mesh; actors live behind them on satellites. The mesh replicates a route table, a CRDT, to every node. Routes are looked up locally; when an actor moves, gossip updates the table and no connection breaks.
Gossip P2P Mesh
┌─────────────────────────────────┐
│ CRDT-replicated route table │
Cluster-0 ◄────── Gossip ──────► Cluster-1
│ │
┌────┴─────┐ ┌────┴─────┐
│ Actor A │ │ Actor D │
│ Actor B │ │ Actor E │
└──────────┘ └──────────┘
A asks F: A → Cluster-0 (local lookup) → Cluster-1 → F
F moves: gossip updates the route; A does not notice
| Concern | Direct P2P | Broker | MLambda |
|---|---|---|---|
| Many actors across nodes | Connections grow with actors | One hub | Connections grow with nodes |
| An actor moves | Connections break | The broker re-routes | Gossip updates the route |
| A node crashes | Its peers fail | The broker is a single point of failure | The mesh detects it and makes the actors again |
| Route lookup | Remote discovery | A broker call | Local, no network call |
| Security | Per connection | At the broker | Every link sealed: Fortress (identities from the cluster’s CA), or open inside one cluster’s own network |
What makes it different
Answers as values
An ask answers Either Fault r: refusals, failures, stopped actors and timeouts are values to match, not exceptions
to catch. Asks simply wait; the runtime’s fibers make waiting cheap. See Answers as Values.
Classes, typed addresses
An actor is a class: a data type and an instance of the Actor trait, with its settings as attributes. Its address
is typed by its class, so a message the actor does not accept is a compile error.
Write once, deploy three ways
The same actors run standalone, in a cluster or on hybrid nodes; a client asks a route the same way in all three. See Topology Transparency.
Native and small
The library is about 8,300 lines of Aleph with no dependencies beyond the Aleph standard library. A service builds to one static Linux executable; the demo’s Docker image is about 6 MB.
Fortress from the cluster’s own CA
Each cluster makes its CA once (fortress-issue) and issues each process an identity; a link is admitted by its
peer’s identity, its frames encrypted and authenticated (an X25519 handshake, then ChaCha20-Poly1305). No TLS to
configure and no external CA. Inside one cluster’s own network the nodes may use the open transport instead.
What a message is promised
At-least-once from the client’s outbox; run at most once per actor incarnation (repeats known by the caller’s message
id); a new ask refused Overloaded while its actor is more than 1,000 asks behind, never dropped untold. Each
promise has a TLA+ model checked by MLambda’s own checker (docs/formal).
Comparison
| MLambda | Akka.NET | Orleans | Proto.Actor | Dapr | |
|---|---|---|---|---|---|
| Language | Aleph (native) | C# | C# | Go, C#, Kotlin | Any (sidecar) |
| Distribution | Virtual P2P mesh | Direct P2P | Silo mesh | Direct P2P | Sidecar proxy |
| Addressing | Typed address; route across nodes | IActorRef, ActorSelection |
Grain interfaces | PID | HTTP/gRPC |
| Answers | Either Fault r |
Tell/Ask, exceptions | Tasks | Futures | HTTP responses |
| Cluster protocol | CRDT route table synced every half second; membership by phi over those syncs | Gossip | Membership table | Gossip / providers | Control plane |
| Encryption between nodes | Built in (Fortress) | Configure TLS | Configure TLS | Configure TLS | mTLS (sidecar) |
| Supervision | One/All for one, by failure kind | Yes | No (virtual) | Yes | No |
| Passivation | @passivateAfter |
Sharding | Automatic | Manual | Automatic |
| Persistence | Through MLambda.Data | Akka.Persistence | Grain state | Event sourcing | State stores |
| Test kit | Probes under aleph test |
TestKit | Test cluster | Limited | Limited |
| Maturity | New | 10+ years | Mature | Mature | Mature |
When to choose each
Choose MLambda when you want
- Erlang-style distribution with a small, readable implementation;
- native services in single static binaries;
- the same code standalone, in a cluster, or hybrid;
- encryption between clusters from the cluster’s own CA, with nothing to configure for TLS;
- to write in Aleph, alongside MLambda.Data and the other MLambda services.
Choose something else when you need
- Akka.NET: event sourcing and streams with years of production use.
- Orleans: virtual actors with automatic lifecycle and pluggable state, on .NET.
- Proto.Actor: actors across Go, C# and Kotlin.
- Dapr: actors as one feature among many, for services in any language.
Concepts across frameworks
| Concept | Akka | Orleans | MLambda |
|---|---|---|---|
| Actor definition | ReceiveActor |
Grain<TState> |
instance Actor C |
| Send | Tell / Ask |
grain.Method() |
tell / ask |
| Reference | IActorRef |
GetGrain<T>() |
Address C |
| Remote reference | ActorSelection |
Silo directory | A route, through a host’s client |
| Supervision | SupervisorStrategy |
— | @supervision(strategy) |
| Behaviour switch | Become |
— | become / unbecome |
| Timers | ScheduleTellOnce |
RegisterTimer |
scheduleOnce |
| Testing | TestKit, ExpectMsg |
Test cluster | Probe.expectMsg |
- Quick Start: your first actor in a few minutes.
- Deployment: every topology in Docker compose.