Supervisor and large numbers of workers

Gunilla Arendt <>
Thu Feb 2 12:46:17 CET 2006

Heinrich Venter wrote:
> Hi all
> The following patch released for ejabberd recently came to my attention.
> 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?

I think it is a trade-off between how important it is for you to follow
the OTP design principles, how well the OTP design application apply to
your specific problem and how good an alternative solution you can come
up with.

> 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 :) ?


/ Gunilla

More information about the erlang-questions mailing list