Supervisor and large numbers of workers

Heinrich Venter <>
Thu Jan 26 09:28:39 CET 2006


Hi all

The following patch released for ejabberd recently came to my attention.
https://support.process-one.net/doc/display/CONTRIBS/Supervisor+-+Perfor
mance+improvement+for+dynamic+workers

It basically replaces the list of processes managed by a supervisor with
a dict.  The reason this is important in ejabberd is because the
supervisor directly handles all the processes that manage users.  For a
large number of users, the list becomes less effective than the dict.

My question is one about OTP design.  Is it better to add worker
processes directly to a supervisor, especially if you know there is
going to be large numbers of them, or is it better to create your own
gen_server to handle the hordes of workers, and just add the gen_server
to the supervisor?

On the one hand it seems like a waste to write a custom gen_server since
the supervisor is already meant to do that type of thing.  On the other
hand the supervisor seems to be meant for narrow hirarchies.

Any chance of the above patch making it into the next release :) ?

-]-[einrich



More information about the erlang-questions mailing list