Visualisation of Elixir Supervision Tree Strategies

Mustafa Turan
ElixirLabs
Published in
1 min readOct 22, 2016

--

Elixir has built in four strategies for supervision trees to enable fault tolerant systems. The names of strategies are :one_for_one, :one_for_all, :rest_for_one, :simple_one_for_one. Enjoy the visualisations…

Strategy / :one_for_one

:one_for_one / if one of the workers dies, then restart it

Strategy / :one_for_all

:one_for_all / If one dies, supervisor kills the rest and then restart all

Strategy / :rest_for_one

:rest_for_one / If one dies, supervisor kills the rest in start order of these processes and then restart all killed workers

Strategy / :simple_one_for_one

Same as :one_for_one. But it needs to implement Supervision.Spec and you need to specify only one entry in child specification. That means every child spawned from this supervisor is the same kind of a process.

References: http://elixir-lang.org/docs/stable/elixir/Supervisor.html#module-strategies

--

--

Mustafa Turan
ElixirLabs

Go, Elixir, Ruby, Software Architecture, Microservices