Supervisor Strategies

Learn the different supervisor strategies used in handling child processes.

Types of supervisor strategies

We left one question unanswered. We used a setting called :strategy with a value of :one_for_one when we created the DynamicSupervisor and Supervisor processes. When creating a supervisor from scratch, we have the following supervisor strategies available:

  • :one_for_one

  • :one_for_all

  • :rest_for_one

They tell the supervisor how to manage child processes that fail.

The one_for_one strategy

So far we’ve used the :one_for_one strategy. This is great when each child process can be restarted independently without impacting other sibling processes.

Get hands-on with 1200+ tech skills courses.