liveBook · Manning

Maximum restart frequency

As explained in Elixir in Action, Third Edition

Restart intensity is the limit on how many child-process restarts a supervisor permits within a configured time interval before terminating itself and its children.

Maximum restart frequency limits how many times a supervisor may restart child processes during a configured interval. The default permits three restarts within five seconds. Configure the limit with :max_restarts and :max_seconds passed to Supervisor.start_link/2. section 8.3.7

The limit prevents a supervisor from retrying an unrecoverable failure forever. When restarts exceed the threshold, the supervisor gives up, terminates itself, and takes down its children. section 8.3.7

Exceeding the default

Start the system, repeatedly kill the to-do cache process, and pause briefly between attempts. Four restarts within five seconds exceed the default, causing the supervisor and its children to terminate.

Restart frequency also shapes supervision-tree design. Separating database workers under their own supervisor confines repeated restart failures to database operations, allowing a parent supervisor to restart that service without disturbing unrelated processes. section 9.1.5

How Elixir in Action, Third Edition covers it

How deep it goes
Explains defaults, configuration, shutdown behavior, rationale, and supervision-tree placement without detailing supervisor internals.
Examples
Uses an Elixir shell loop that kills a cache process four times and observes the resulting supervisor shutdown.
What it assumes
Assumes familiarity with supervisors, child processes, and starting supervised systems.
What you can do after
Configure restart limits and isolate volatile worker groups under separate supervisors.
How it connects
Connects supervisors, child processes, fault tolerance, supervision trees, and failure isolation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.