I was going through the docs of both supervisor and dynamic supervisor and saw that supervisor also has the function start_child that will allow us to start a worker dynamically using child_spec. Can anyone please elaborate what additional benefits DynamicSupervisor offers us since we can start workers dynamically using Supervisor module as well ?
here is some background:
We can already start a child in the normal Supervisor
by passing in a child spec so what benefits does DynamicSupervisor
give us?
DynamicSupervisor
supports the extra_arguments
option, designed to replace the behavior of simple_one_for_one
Supervisors.
DynamicSupervisor
also supports a max_children
option.
I’d like to cross-reference this topic that helped me understand a little bit more about it, just in case someone else finds this first in the future (like I did): Difference between Supervisors and DynamicSupervisors what am I missing?.
PS.: In summary, DynamicSupervisors
is a special module with performance optimizations for this specific use-case (new docs are on the way to make this a bit more clear).
Hey thanks a lot.