Actors and isolation
An actor is an independent unit with private state that communicates only by sending messages to a mailbox. It processes one message at a time, so there is no shared memory race inside it. Failures are isolated because one actor crashing does not corrupt another.
Let it crash
The actor philosophy is let it crash: rather than defensively handling every error, an actor that hits a bad state simply fails, and someone else restores it. That someone is its supervisor.
The supervision hierarchy
Actors form a tree. A parent supervises its children and decides what to do when one fails:
- Restart the failed child to a clean known state.
- Stop the child permanently.
- Escalate the failure up to its own parent.
A supervisor also chooses a strategy: under one for one only the failed child restarts, while under all for one all siblings restart together because they share dependent state.
Why trees contain faults
Because failures travel up to a supervisor and recovery comes back down, faults are contained at the lowest level that knows how to recover. Healthy parts of the tree keep running untouched.
Key idea
Supervision trees pair isolated message driven actors with parent supervisors that restart, stop, or escalate failures, containing each fault at the lowest level capable of recovering from it.