Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang - Elixir: What is a supervision tree?

I'm doing a tutorial and it says "In this guide, we will learn how to build a complete Elixir application, with its own supervision tree, configuration, tests and more".

In plain english, what is a supervision tree in Elixir?

Thanks!

like image 664
Liz Parody Avatar asked Oct 03 '17 22:10

Liz Parody


People also ask

What is a supervision tree in Elixir?

Supervision tree is a tree-like structure of supervised processes, where the structure itself handles starting, terminating, and restarting processes according to our instructions (see restart strategies).

What is supervision tree?

1.1 Supervision Trees Supervisors are processes that monitor the behaviour of workers. A supervisor can restart a worker if something goes wrong. The supervision tree is a hierarchical arrangement of code into supervisors and workers, which makes it possible to design and program fault-tolerant software.

What is supervisor in Erlang?

Supervisors are one of the most useful part of OTP you'll get to use. We've seen basic supervisors back in Errors and Processes and in Designing a Concurrent Application. We've seen them as a way to keep our software going in case of errors by just restarting the faulty processes.

What is OTP elixir?

What are Elixir and OTP? Elixir is a functional programming language built on the Erlang VM. OTP is a process oriented programming framework integral to Erlang and Elixir.


1 Answers

In Erlang and Elixir applications, structure is imposed by having a top-level "supervisor" processes which starts the other processes in your application. Those other processes can include other supervisors, which also have their own children, and this recursive structure takes the shape of a tree, hence "supervision tree". Supervision of processes is what gives Erlang/Elixir it's fault tolerance features, as failure is isolated to some branch of the tree, where the supervisor of that branch can either restart the failed children, or allow itself to fail as well, bubbling the failure up to the next highest supervisor in the tree.

like image 120
bitwalker Avatar answered Oct 01 '22 05:10

bitwalker