[erlang-questions] start_child() on simple_one_for_one supervisor -> {error, {already_started, ...}} ???

Dominic Williams erlang@REDACTED
Tue Dec 16 20:50:43 CET 2008


Hi mighty,

mighty a écrit :
> P.S. How scalable is registering processes? E.g., Is
> registering 64K processes not going to scale, as well as
> potentially impact others using registered names? It
> seems like there's a hash table for registered processes
> in register.c that starts off pretty small.

I don't know the answer to your question.

However, I do think that registering processes is not a 
particularly good idea in general, and is especially wrong 
in your case, when the processes will be created dynamically.

The only point of registering a process is to be able to 
call it later, by its name. This is bad enough (it's really 
like having a global variable, it's hell to test, etc).

If the names are dynamic, then that also defeats the 
purpose: you can't actually call dynamic names without 
having some sort of previous knowledge of which names have 
been created (in which case you might as well store the pids).

It is perfectly possible to create a gen_server without 
registering it.

Having it restarted by a supervisor is a bit more 
challenging (because the pid can change), but is still 
manageable in many cases.

Just a thought which seemed worth pointing out in your 
situation.

Regards,

Dominic Williams
http://dominicwilliams.net

----



More information about the erlang-questions mailing list