liveBook · Manning

Recovery

As explained in Elixir in Action, Third Edition

Error detection and recovery is a set of mechanisms for identifying failures and restoring affected computation or service.

A recovery strategy detects failures and restores affected computation or service. In server-side systems, Erlang processes and error-detection primitives support reliability, fault tolerance, scalability, and distribution. section 1.1.3

Supervision turns recovery into service lifecycle management. A supervision tree organizes supervisors and workers, defines startup and shutdown order, and limits failures to the smallest useful service boundary. section 9.1.6

A hierarchical recovery strategy can behave as follows:

  • Restart a crashed database worker while leaving unrelated services running. section 9.1.6
  • Terminate a database service and its descendants through the parent supervisor when a larger unit must be taken down. section 9.1.6
  • Escalate after the restart frequency limit is exceeded: stop the database workers and supervisor, then let the system supervisor start a fresh database pool. section 9.1.6

One platform, multiple recovery needs

A web server may need concurrent request handling, long-running requests, server-wide state, persistent data, background jobs, and service crash recovery. A single Erlang-based system can address these requirements with platform features rather than separately deployed technologies. section 1.1.3

Figure 9.4 Supervision tree
CH09_F04_Juric3

Use the supervision-tree diagram to trace service hierarchy, failure propagation, restart boundaries, and controlled shutdown. section 9.1.6

How Elixir in Action, Third Edition covers it

How deep it goes
Explains supervision hierarchy, startup and shutdown, restart boundaries, escalation, and restart-frequency limits.
Examples
Uses a database-worker crash, a nested service tree, and a comparison of two web-server technology stacks.
What you can do after
Operate supervised services by reasoning about failure propagation, restarting workers, terminating child services, and escalating recovery.
How it connects
Connects error recovery with Erlang processes, supervision trees, supervisors, workers, fault tolerance, and distributed systems.

Also explained in

Compare how 3 books explain recovery →

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.