Elixir Supervision Tree 策略可视化

Elixir内置有四种supervision trees的容错机制,分别是 :one_for_one, :one_for_all, :rest_for_one, :simple_one_for_one

Strategy / :one_for_one

Elixir Supervision Tree 策略可视化_第1张图片

Strategy / :one_for_all

Elixir Supervision Tree 策略可视化_第2张图片

Strategy / :rest_for_one

Elixir Supervision Tree 策略可视化_第3张图片

Strategy / :simple_one_for_one

:one_for_one.相同。但是需要实现Supervision.Spec。
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.

Refs

http://elixir-lang.org/docs/stable/elixir/Supervisor.html#module-strategies
https://medium.com/@mustafaturan/visualisation-of-elixir-supervision-tree-strategies-4d4cb8123138#.oo26snkdk

你可能感兴趣的:(Elixir Supervision Tree 策略可视化)