Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Actor Systems In Rust: Techniques and Tradeoffs
Search
Andrew J. Stone
November 16, 2017
Programming
350
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Actor Systems In Rust: Techniques and Tradeoffs
Andrew J. Stone
November 16, 2017
More Decks by Andrew J. Stone
See All by Andrew J. Stone
Actor Systems in Rust (Boston Rust Meetup Version)
ajs
0
86
Implementation and Verification of a Consensus Protocol in Erlang
ajs
0
260
Other Decks in Programming
See All in Programming
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.2k
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
150
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
180
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
720
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
400
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
14
6.7k
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
260
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
840
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
130
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.9k
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
220
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.8k
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
890
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
880
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
560
How to build a perfect <img>
jonoalderson
1
5.8k
GitHub's CSS Performance
jonrohan
1033
470k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
Scaling GitHub
holman
464
140k
Statistics for Hackers
jakevdp
799
230k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
370
Evolving SEO for Evolving Search Engines
ryanjones
0
240
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
490
Transcript
Actor Systems in Rust: Techniques and Tradeoffs Andrew J. Stone
Haret Distributed Coordinator and KV Store
Haret Multiple Independent Consensus Groups
Haret Protocol Viewstamped Replication Revisited for Consensus
Haret Backend • Versioned persistent trie per consensus group •
CAS on entire subtrees • Typed Leaves • Blob • Queue • Set
[email protected]
[email protected]
[email protected]
p1 p2 p3 Request (1) Prepare (2)
PrepareOk (3) Prepare (2) PrepareOk (3) Reply (4)
Actors Processes That Communicate Only via Asynchronous Msg Passing
Actors Straightforward Representation of Peers in a Consensus Group
Rabble Actor Abstractions for Implementing Distributed Algorithms
Rabble Dynamic Cluster Membership, Transport and Msg Routing
Rabble Designed for Testability
Rabble A Work in Progress
Rabble Provides a clean way to implement VRR in Haret
Naming pub struct Pid { pub group: Option<String>, pub name:
String, pub node: NodeId, }
Messages pub enum Msg<T> { User(T), ClusterStatus(ClusterStatus), ExecutorStatus(ExecutorStatus), StartTimer(usize), //
time in ms CancelTimer(Option<CorrelationId>), Timeout, Shutdown, GetMetrics, Metrics(Vec<(Name, Metric)>) } { Rabble built-ins User Defined
Envelopes pub struct Envelope<T> { pub to: Pid, pub from:
Pid, pub msg: Msg<T>, pub correlation_id: Option<CorrelationId> }
pub trait Process<T> : Send { /// Handle messages from
other actors fn handle(&mut self, msg: Msg<T>, from: Pid, correlation_id: Option<CorrelationId>, output: &mut Vec<Envelope<T>>); } Processes
Echo Server P1 (Client) Envelope { to: P2, from: P1,
msg: Msg::User<Hello>, correlation_id: Some(P1) } Envelope { to: P1, from: P2, msg: Msg::User<Hello>, correlation_id: Some(P1) } P2 (Server)
impl Process<T> for EchoServer<T> { fn handle(&mut self, msg: Msg<T>,
from: Pid, cid: Option<CorrelationId>, output: &mut Vec<Envelope<T>>) { match msg { Msg::User(Hello) => { let to = from; // P1 let from = self.pid.clone(); // P2 let msg = Msg::User(Hello); let reply = Envelope::new(to, from, msg, cid); output.push(reply); }, _ => () } }
Executor Locates and Runs Processes
P1 P2 P3 Hashmap<Pid, Process> Executor Channel To: P1 Thread
Handle
Property Based Testing 1. Construct a group of processes in
an initial state 2. Generate a schedule of test messages 3. Call the handle method of a process with a test message 4. Collect output messages of handle method 5. Schedule output messages
Test Scheduling Trigger Protocol State Transitions with Explicit Timeouts
Test Assertions •Pre/Post conditions •Global state invariants
Failing Tests Failing Schedules Run as a Regression Suite
Debugging Each Message Receipt is One Step in a Test
Schedule
Cluster Server Non-blocking Single Threaded Server with TCP Connections to
every node
Membership Dynamic Membership Maintained in an Observed-Remove Set
Services Actors that Run Blocking and CPU Intensive Operations
Takeaways
Takeaway Dynamic Messaging is Complex Expensive, and Unergonomic for Distributed
Actors in Rust
Takeaway Writing Good Schedulers is Hard
Takeaway Design your systems to make deterministic testing easier
Takeaway Compromise and Pragmatism allow a good enough solution that
works NOW
Links • https://github.com/andrewjstone/rabble • https://github.com/andrewjstone/orset • https://github.com/vmware/haret
Thanks! Tom Santero Justin Sheehy VMware