Search⌘ K
AI Features

Establishing Supervision Strategies

Explore how to establish supervision strategies in Elixir projects using OTP child specs. Understand the startup, restart, and shutdown policies that control worker processes and supervisors to build robust and maintainable applications. Learn to manage process dependencies and lifecycles effectively for reliable system operation.

As you’ll recall, when we build a child spec, we define the naming and lifecycle strategies our supervisors will apply to child processes. In general, this configuration code guides OTP in building the lifecycle.

Starting a worker

Let’s talk about what happens when we start a worker:

  • At startup, the worker will go down the list of child specs and start each of them using the child specs.

  • Some of those child specs will identify other supervisors or applications. Our application.ex child list has both.

  • Application.start then walks down a list of children and starts each one. Those children could be single processes, such as our QuizManager, or they could be applications in their own right.

Spinning up a child application means loading that application’s child list, and so on. That means our child list is a supervision tree.

Starting your application

Starting our ...