[erlang-questions] simple_one_for_one supervisor - what happens at restart? (also: gen_tcp)

Oliver Korpilla Oliver.Korpilla@REDACTED
Sat May 14 19:16:35 CEST 2016


Hello, Ryan.

Isn't this normally the job of a registry like gproc or am I misunderstanding your requirements?

I usually start the worker dynamically through the supervisor and let it do its own registration.

Cheers,
Oliver
 

Gesendet: Samstag, 14. Mai 2016 um 18:57 Uhr
Von: "Ryan Stewart" <zzantozz@REDACTED>
An: "Loïc Hoguin" <essen@REDACTED>, Chandru <chandrashekhar.mullaparthi@REDACTED>
Cc: "Erlang-Questions Questions" <erlang-questions@REDACTED>
Betreff: Re: [erlang-questions] simple_one_for_one supervisor - what happens at restart? (also: gen_tcp)

On Sat, May 14, 2016 at 3:28 AM Loïc Hoguin <essen@REDACTED> wrote:The primary function of supervisors is to provide a hierarchy of
processes belonging to an application. With such a hierarchy it becomes
possible to find and query information about any single process in your
system in a standard manner.
 
I'm rather interested in this aspect of supervised processes. Especially in the case of a simple_one_for_one supervisor, it's unlikely that the supervised processes will be registered, and it's possible that there could be a rather large number of them--maybe in the tens or hundreds of thousands, depending on the use case. I'm curious how others deal with finding a specific temporary process if, for instance, you want to check on the progress of the work it's doing.
 
My current solution is to have a locally registered "manager" process as a supervised sibling to the SOFO worker supervisor, and the manager just has a dict that maps UUIDs to worker PIDs. I.e. creating a "worker" process entails both a supervisor:start_child() call and storing the worker id -> pid mapping in the manager. Is this a typical way to handle temporary workers?_______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions[http://erlang.org/mailman/listinfo/erlang-questions]



More information about the erlang-questions mailing list