Supervision: A parent actor monitors its children and decides how to recover them (restart, stop, escalate) when they crash. Supervision is how actor systems like Erlang and Akka handle failure. Every actor has a parent, its supervisor, which watches it. When a child crashes, the supervisor decides what to do: restart it, stop it, or pass the problem up to its own supervisor.
This leads to the "let it crash" philosophy. Instead of defensive code for every possible error, an actor that ends up in a bad state simply fails, and its supervisor restarts it in a known good state.
What should you keep in mind with Supervision?
The idea shows up outside actor systems too. Kubernetes restarts crashed containers, systemd restarts failed services, and process managers like Supervisor keep queue workers running. Combined with good logging and alerts on frequent restarts, it makes systems recover from many problems without anyone stepping in.
Use when code runs things at the same time - threads, async/await, queues and workers, parallel requests, cron jobs, webhooks that retry - or when a bug only happens "sometimes" or under load. Covers race conditions, deadlocks, mutexes/locks, atomic operations, idempotency, message queues and backpressure, with Laravel and database examples.
Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.