[erlang-questions] Logic in the supervisor?

Mike Oxford moxford@REDACTED
Sat Apr 9 18:51:22 CEST 2011


It's more than a 'good fit' and it's almost exactly what I was looking at
building myself.

Thank you!

-mox

On Sat, Apr 9, 2011 at 5:14 AM, Mihai Balea <mihai@REDACTED> wrote:

>
> On Apr 8, 2011, at 8:05 PM, Mike Oxford wrote:
>
> > I have a pool of resources, say 10k children(FSMs) each holding a
> resource.
> >
> > If I want to remove a resource from the pool, of which they may be
> duplicates, I have two options.
> >
> > 1)  Walk the list of children and tell each one "hey, if this is you,
> close up shop."
> > 2)  Maintain a dict/ETS of all resources, which has more run-time
> overhead and a higher likelyhood
> >      of "something happening."
> >
> > If the supervisor dies, all resources are shut down as they're children,
> so having the supervisor maintain
> > the dict/ETS is an option.
> >
> > Having another FSM outside the call-tree maintaining that status is an
> option but, in the case of that
> > FSM going down then all resources are "lost" and should be
> released....which minics the case of
> > a supervisor going down..
> >
> > So...
> > Do I maintain state external to the supervisor or..
> > Have the supervisor maintain state or...
> > Just deal with the message-storm on resource removal?
>
> Have you looked at proc / gproc?
> If your children can be identified by some sort of name or tag, then it
> might be a good fit for you.
>
> Mihai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110409/443f7413/attachment.htm>


More information about the erlang-questions mailing list