liveBook · Manning

Resilience

As explained in Elixir in Action, Third Edition

Fault tolerance is the ability of a system to continue providing acceptable service when components fail or errors occur.

Fault tolerance keeps a system providing acceptable service when bugs, component failures, overload, network problems, or machine crashes occur. It localizes failures, minimizes their effects, detects them, and recovers automatically instead of allowing one error to take down the entire system. section 8.0 section 1.1.1

BEAM systems pursue fault tolerance through several cooperating mechanisms:

  • Isolate work in independent BEAM processes that share no memory, so one crash does not directly corrupt or stop unrelated work. section 1.1.2 section 8.2
  • Detect failed processes and recover by restarting them or reconnecting dependent components. section 1.1.2 section 8.0
  • Use process links and supervisors to propagate failures where necessary and coordinate self-healing without burdening the main code with defensive error handling. section 12.2.6
  • Keep partial service available during dependency failures, such as serving cached data and queueing writes while a database connection is restored. section 8.0
  • Distribute nodes across machines so another machine can continue service when one crashes, while preparing for broken connections and netsplits. section 12.4

An isolated process failure

One spawned process raises an exception while another sleeps and later prints that it finished. The failed process reports an error, but the second process and the interactive shell continue running. A related to-do architecture isolates individual to-do servers from one another and lets cached reads continue when the database process crashes. section 8.2 section 8.2

Figure 1.1 Concurrency in the Erlang virtual machine
CH01_F01_Juric3

Shows how the BEAM schedules many isolated processes within a single runtime, the foundation for fine-grained fault containment. section 1.1.2

How Elixir in Action, Third Edition covers it

How deep it goes
Explains failure isolation, detection, recovery, supervisors, process links, fallbacks, and distribution, while deferring detailed production diagnosis.
Examples
Uses a spawned-process crash, an isolated to-do system, database-cache fallback, queued writes, and multi-machine failover scenarios.
What it assumes
Introduces BEAM processes without assuming they are OS processes and grounds the discussion in concurrent server systems.
What you can do after
Build it with BEAM processes, links, supervisors, and distribution to isolate failures and recover service.
How it connects
Connects fault tolerance to concurrency, process isolation, supervisors, high availability, scalability, distribution, and microservices.

Also explained in

Compare how 13 books explain resilience →

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.