Visualisation of Elixir Supervision Tree Strategies

Mustafa Turan
Oct 22, 2016 · 1 min read

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

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

Strategy / :one_for_all

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

Strategy / :rest_for_one

Image for post
Image for post
: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

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store