Actix: Actor Lifecycle, When It Fits & vs. async/await
Actor Lifecycle
An actor progresses through started, running, stopping, and stopped states. Once stopped, its mailbox is closed and it no longer accepts or processes new messages -- resources can then be cleaned up.
Resilience Through Restart
If an actor encounters an unrecoverable error, restarting it in a clean state can be a more resilient recovery strategy than the whole application crashing or entering an inconsistent state -- a pattern with roots in Erlang/OTP's supervision trees.
Sequential Processing: A Real Trade-off
Sequential message processing gives an actor predictable, race-free state transitions -- but a slow message handler can create a growing mailbox backlog if messages arrive faster than they're processed, a real capacity consideration for high-throughput actors.
When Actors Fit Well
Chat rooms and game sessions -- independent, stateful components processing events sequentially.
Systems where many concurrent, stateful units need to interact without manual lock coordination.
Simulations or servers where isolating failure to one component (via restart) matters.
Actors vs. Plain async/await
Actors excel at modeling independent, stateful, message-driven components; plain async/await often suffices for simpler request/response or pipeline-style logic that doesn't need that stateful, message-passing structure.
Keep your own version of these notes — editable, searchable, and organised by your stack.
Start free