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

Edmond Begumisa <>
Mon Mar 7 01:17:26 CET 2011


On Sat, 05 Mar 2011 16:49:12 +1100, Dhananjay Nene  
<> wrote:

> 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
>

If you reconsider whether you really need a DB then...

> a. Supervisor looks up state in db and feeds it to child during init

Hand-wavy.

> b. Child self checks state in db on init.

Better.

- Edmond -

>
> Thanks
> Dhananjay
> --
> -----------------------------------------------------------------------------------
> http://blog.dhananjaynene.com twitter: @dnene
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the erlang-questions mailing list