tellus
0.6.0 actor framework for Rust built on Tokio Apache 2.0

Actors for Rust, on solid ground.

tellus gives you typed actors as state machines, supervision trees and a death watch you can reason about. Add event sourcing and a cluster when you need them.

Message handlers
a group of devices
GroupMessage::Record {
    device_name,
    degrees,
} => {
    let device = devices
        .entry(device_name)
        .or_insert_with(|| context.spawn(Device));
    device.tell(DeviceMessage::Record(degrees));
    Ok(Control::Continue(devices))
}

A message handler is a plain function.

Carl Hewitt defined an actor by what it may do in response to a message. A tellus receive does exactly that and nothing more. It runs to completion, so an actor is never halfway through a message with its state in limbo.

When an actor needs to wait for something, the result arrives as another message, so actor code never awaits. Even event sourcing works this way: the handler returns the events as data, and tellus does the I/O.

Why tellus handlers are synchronous →
Death watch

Know when an actor is gone, and know you have heard everything it said.

Receiving Terminated proves you have seen every message that actor will ever deliver to you.

Watch any actor with context.watch(&actor). When it terminates, you get a signal in your ordinary mailbox, ordered behind every message the actor delivered to you. Each of its messages arrived before the signal or was dropped as a dead letter.

So you can gather results from workers without counting replies, timeouts or extra acknowledgments: when the last worker's signal arrives, you have every result the workers delivered. And unwatch means what it says, even if the signal is already waiting in your mailbox.

How the ordering guarantee works →
A device delivers two readings to the group watching it, a third is dropped as a dead letter, the device stops, and the Terminated signal arrives last.devicegroupReading(21.5)Reading(22.0)Reading(22.4)mailbox full: dead letterstopsTerminated(device)always last
The group watches the device: whatever the device delivered arrives before Terminated.
locally

Ordered and exact

The signal is ordered behind every delivered message and proves that the actor's destructors have run. It is delivered even when a bounded mailbox is full.

across nodes

Same API, two tiers

A real termination keeps the full local contract over the wire. If the actor's node is downed instead, the synthesized signal guarantees that no message from that actor is delivered on the watcher's node again.

unwatch

No stale signals

After unwatch returns, you never receive a terminated signal for that actor, even if one was already enqueued, unless you stash it yourself.

Supervision

Let it crash, then restart it calmly.

Actors form a tree. When init or receive returns an error or panics, the actor's supervision strategy decides what happens. Stop terminates the actor. Restart stops its children and runs init again for a fresh state; the actor keeps its address and mailbox.

Restarts back off exponentially between min and max. More than max_restarts consecutive failures stop the actor, and running for reset_after without failure starts the count afresh. Stopping always goes bottom-up: children first, then the parent.

How actors fail, restart and terminate →
To scale: three failures followed by restarts after 250 ms, 500 ms and 1 s; the fourth consecutive failure stops the actor.0 s0.51.01.52.02.53.0250 ms500 ms1 s✕ failure▬ backoff━ running4th failure: stop
a device's configuration
mailbox_capacity = { bounded = 100 }

[supervision_strategy.restart]
max_restarts = 3
reset_after  = "30s"
backoff      = { min = "250ms", max = "4s" }
Event sourcing persistence

Persist the events, replay the state.

Implement EventSourced instead of Actor. Your handler validates a command and returns an Effect naming the events it causes. tellus appends them to the store, and only then folds them into the state. After a crash, replay rebuilds the state from the events, optionally shortcut by a snapshot.

Conditional appends fence concurrent incarnations, and manifests version your event schemas. A contract test suite checks any store backend. PostgreSQL ships today in tellus-persistence-postgres; an in-memory store and TestContext let you test without a database.

What tellus guarantees about event sourcing →
an event-sourced device
fn handle(
    &self,
    _: &ActorContext<Self::Command>,
    incoming: Incoming<Self::Command>,
    _: &Self::State,
) -> Result<Effect<Self>, Self::Error> {
    let Incoming::Message(command) = incoming else {
        unreachable!("the device watches no actor, hence never gets a terminated signal")
    };

    match command {
        Command::Record(degrees) if degrees.is_nan() => Err(InvalidReading),

        Command::Record(degrees) => Ok(Effect::persist(Recorded(degrees))),

        Command::Read(reply_to) => {
            Ok(Effect::none().then(move |last_reading| reply_to.reply(*last_reading)))
        }
    }
}

fn apply(&self, _: Self::State, Recorded(degrees): Self::Event) -> Self::State {
    Some(degrees)
}
  1. handleValidates the command and returns an Effect.
  2. appendtellus appends the events to the EventStore, conditional on the stream's head.
  3. applyOnly durable events are folded into the state, the same way on replay as live.
  4. thenSide effects such as the reply run once the events are durable.
Cluster cluster

Same API, many nodes.

With the cluster feature, ActorRef is serializable, so a message can carry a reference to an actor on any node. You tell, ask and watch remote actors through the same API as local ones. Nodes find each other through seed discovery, gossip their membership, and agree on who is gone. The clustered actors tutorial spreads the device manager over three nodes.

tellus-cluster-demo-tui · 5 nodes · chaos on

Five nodes under continuous crashes, departures and partitions, with a verifier checking convergence, cross-node messaging and the receptionist in every quiet window. Run it yourself.

QUIC with mutual TLS

Transport over quinn, with every node authenticated by the cluster's own certificate authority, and messages in order per sender and recipient across the wire.

Address-bound certificates

A node is admitted only at an address its certificate covers, so an authenticated node cannot claim another member's address.

Seed discovery

Fixed seeds, DNS SRV or A/AAAA records, or Kubernetes pods by label selector.

Gossiped membership

The member list is a state-based CRDT, so duplicated, reordered or crossed gossip cannot corrupt it.

Failure detection and downing

Phi accrual detection and a pluggable downing provider; KeepMajority by default.

Graceful leave

A node that stops announces its departure and drains its queues, so the others list it as left without detecting a failure.

Cluster identity

Every cluster has an ID, and every connection names it. A node of another cluster is refused. Two clusters never merge, and a split into two is reported.

Receptionist and pub-sub

Register actors under a key, look them up across the cluster, and publish to every subscriber of a topic.

Observable cluster state

A versioned value on every change; tellus-cluster-inspect serves it to you as server-sent events.

tellus-cluster-demo/config/default.yaml
bootstrap:
  min_nodes: 5

endpoint:
  app_version: "1.0.0"
  failure_detector:
    phi_accrual: {}
  downing_provider:
    keep_majority:
      after: 10s
tellus-cluster-demo/config/k8s.yaml
seeds:
  k8s:
    label_selector: app=tellus
    port:
      number: 7878
On the roadmap:cluster singletonsharding
Benchmarks

Measured fairly, published openly.

We benchmark tellus against kameo and ractor, two actively maintained actor frameworks that also run on a plain Tokio runtime. Every framework does the same work, and the competitors run in their fastest configuration, not their defaults.

flood100,000 messages to a single counting actor.
ping_pong1,000 rounds between pairs of actors, one pair and eight pairs.
fan_out100,000 messages round-robin to 8 and to 32 workers.
See the results on the comparison dashboard →

Speed is one difference among many. Rust actor frameworks compared sets tellus next to actix, kameo and ractor, feature by feature.

We also watch our own hot path. hotpath profiles every pull request against main, comparing instruction counts and allocations per function, and its check fails when sending a message or replaying events starts to allocate.

See the history on hotpath.rs →
  1. One run, one machine, back to back. Numbers are only compared within a single run.
  2. Unbounded mailboxes everywhere, so no framework drops or backpressures messages the others do not.
  3. Non-blocking fire-and-forget sends only, no awaited sends and no request-response.
  4. Identical timing boundaries. Spawning happens outside the measurement; sending and termination inside it.
  5. The same Tokio runtime with the same configuration for all three.
  6. Competitors tuned for speed. Their per-message tracing is switched off, which makes kameo 12.5% and ractor 21% faster on flood.
  7. Termination checks correctness. A lost message makes a benchmark hang rather than finish early.
Get started

Start digging.

Add tellus, Tokio and anyhow to your project, then work through the getting started tutorial. Its last three steps also use thiserror and tracing-subscriber. Each step is a complete program and builds on the previous one.

shell
cargo add anyhow
cargo add tokio --features macros,rt-multi-thread
cargo add tellus
Start the tutorial
  1. Hello, tellusOne actor handles one message and stops.
  2. A device actorState as a value, tell without waiting, ask with a timeout.
  3. A group of devicesChild actors spawned on demand, stopped bottom-up.
  4. Watching devicesLearn when an actor is gone, after all of its messages.
  5. Asking all devicesA query actor per request that cannot hang.
  6. When devices failRestart with backoff, and stop for good.
  7. A device managerOne more level on top, after the IoT example of Apache Pekko.
  8. Stale readingsA timer forgets old readings, and an actor opts into timers by its type.