Keynote | Actors with Tokio – a lesson in ownership
summary
Shows an actor pattern using Tokio: a background task owns a TCP stream and a separate handle with cloned mpsc sender for shared access sends enum messages that include a oneshot per-message response so replies match requests. run() is tokio::spawn of a future that owns the actor; avoid lifetimes on message types to keep the future 'static. Covers timers and tokio::select, warns to use std::thread::spawn (not spawn_blocking) for blocking IO, and explains backpressure options: await on bounded send, try_send, drop/load-shed, or unbounded growth.
AI-written summary · about
chapters (12)
- 0:00Keynote introduction
- 1:38Actors and ownership in Rust
- 2:47Actors for IO resources
- 4:17Actor message passing example
- 8:13Ownership in actors
- 12:36Lifetime annotations and their pitfalls
- 21:25Actor implementation flexibility
- 25:49Minimal Tokio actor
- 26:54Actor design tips
- 30:08Back pressure handling
- 35:49Dynamic dispatch
- 38:04Q&A
related talks
33mStorage-intensive apps on tokio: when it's time to reach for io_uring
30mDay2 02 Sean Klein
21m"Actors and Factories in Rust"
32mTechniques for writing concurrent applications with asynchronous I/O
22mUsing Tokio for CPU-Bound Tasks (Works Really Well)
31mThrough the Fire and the Flames
16mBuilding a Production Control Plane with Tokio
05m“Using async-profiler to Find Tail Latency Issues”
