[erlang-questions] (noob-help) Supervision strategies to automatically restart dynamically added children

Dhananjay Nene <>
Sat Mar 5 06:49:12 CET 2011


On Thu, Mar 3, 2011 at 10:29 PM, Jesper Louis Andersen
<> wrote:
>
> On Wed, Mar 2, 2011 at 19:02, Dhananjay Nene <> wrote:
> > Question in short : If I have a supervisor which has a number of
> > dynamic children, how do I set up a mechanism where in case of a
> > complete system crash, all the dynamic children restart at the point
> > they were when the system (including the supervisor) crashed.
>
> Your only chance is to evacuate the state somewhere else or make all
> dangerous things happen in another process. You have to decide to
> which extent you want to persist the data on disk so you can read it
> in again. Personally, I would probably be looking at persisting the
> game state. The alternative solution also includes another machine
> that can take over the games.
>
> There is a blog post of mine,
> http://jlouisramblings.blogspot.com/2010/11/on-erlang-state-and-crashes.html
> which I'll shamelessly plug because it gives some more ideas on how to
> think about this.
>

I read the post again, and again, and then again. While it did not
give me a straight answer, it gave me the right framework to think
through the answer, which is wonderful.

I do have a follow up question, assuming the state is in the database
to recover from, which option of the below is considered more
idiomatic if at all there exists such a distinction

a. Supervisor looks up state in db and feeds it to child during init
b. Child self checks state in db on init.

Thanks
Dhananjay
--
-----------------------------------------------------------------------------------
http://blog.dhananjaynene.com twitter: @dnene


More information about the erlang-questions mailing list