← Lessons

quiz vs the machine

Platinum1820

Concurrency

Actor Supervision Trees

Organizing actors into hierarchies where parents restart failed children to contain faults.

6 min read · advanced · beat Platinum to climb

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.

Check yourself

Answer to earn rating on the learn ladder.

1. Why is there no shared memory race inside one actor?

2. Under a one for one strategy, what happens when a child fails?

3. What does the let it crash philosophy favor?