Introduction
Rust’s actor ecosystem is flourishing with multiple libraries offering unique approaches to concurrency and distributed system design. This post shares the results of a benchmarking study comparing the performance and features of five popular Rust actor libraries:
Why Benchmark These Libraries?
The primary objective is to evaluate throughput and latency under realistic workloads. By assessing message passing efficiency and actor creation speed, we can better understand the trade-offs each library makes. Although each library caters to different use cases (e.g., distributed environments, supervision, etc.), this benchmarking study provides a starting point for developers choosing an actor library in Rust.
Benchmarking Overview
Libraries Compared
Below are the latest stable releases of the libraries tested:
- Actix – A mature framework that uses its own runtime (“Actix runtime”) which is built on Tokio.
- Coerce – Built atop Tokio, offering distributed actors.
- Kameo – Also uses Tokio, focusing on both local and distributed scenarios.
- Ractor – Relies on Tokio, with support for Async Std, distribution and fault tolerance.
- Xtra – Supports multiple runtimes (Async Std, Smol, Tokio, Wasm Bindgen).
Hardware & Software Setup
- Machine: MacBook Pro (2.4 GHz 8-Core Intel Core i9, 32 GB memory)
- Rust: 1.84.0
- Benchmarking Tool: Criterion.rs
Goals & Metrics
-
Messaging Throughput & Latency
- This involves “tell requests” (fire-and-forget) to 100 spawned actors in a round-robin fashion.
- Measure how quickly the system processes a specified number of messages.
-
Actor Creation Speed
- Measure how quickly each library can spawn and initialize a set of actors.
-
Additional Criteria
- Runtime Used: Does the library rely on Tokio, a custom runtime, or another option?
- Fault Tolerance & Distributed Communication: Not benchmarked, but compared with eachother in the feature comparison table.
Fairness & Transparency
Despite being the author of kameo, all libraries were benchmarked using their default configurations. No library received special optimizations.
The complete benchmark code is open-sourced at:
Feature Comparison
Below is a high-level overview of each library’s capabilities, including mailbox configurations, supervision, and distributed actors:
Feature | Actix | Coerce | Kameo | Ractor | Xtra |
---|---|---|---|---|---|
Bounded Mailboxes | ✅ | ❌ | ✅ | ❌ | ✅ |
Unbounded Mailboxes | ❌ | ✅ | ✅ | ✅ | ✅ |
Ask Requests (Message + Reply) | ✅ | ✅ | ✅ | ✅ | ✅ |
Tell Requests (Fire and Forget) | ✅ | ✅ | ✅ | ✅ | ✅ |
Supervision | ✅ | ✅ | ✅ | ✅ | ❌ |
Distributed Actors | ❌ | ✅ | ✅ | ✅ | ❌ |
Runtime Used | Actix | Tokio | Tokio | Async Std Tokio |
Async Std Smol Tokio Wasm Bindgen |
Latest Release | Jun, 2024 | Oct, 2023 | Jan, 2025 | Jan, 2025 | Feb, 2024 |
Benchmark Scenarios
-
Message Passing Efficiency
- Scenario: Spawn 100 actors, send a round-robin series of “tell requests” (fire-and-forget) to each actor, and measure the time per message.
- Rationale: This test more realistically simulates real-world concurrency than sending messages to a single actor.
-
Actor Cr