[erlang-questions] gen_server message queue length increasing

Ulf Wiger ulf.wiger@REDACTED
Sat Nov 5 13:52:55 CET 2011

On 4 Nov 2011, at 15:22, Magnus Klaar wrote:

> There is also one possible issue with your server which is that you are starting the child processes directly from the same server receiving the EXIT and DOWN messages. In the process info you included you can see that the current function is proc_lib:sync_wait, this call happens to be inefficient on processes with large inboxes, it'll likely turn out to be much more of a bottleneck than the ETS calls in delete_by_pid.

That's true. Actually, it ought to be possible to make proc_lib:start_link() insensitive to mailbox length in the same way as gen_server:call(), since the spawn_link() function produces a pid() that cannot possibly be in the message queue already.

Even more interesting, perhaps, is to find out whether the gen_server is blocking, waiting for a child to respond with proc_lib:init_ack/2. This is the very purpose of being in proc_lib:sync_wait(), and would also explain why it isn't picking up other messages from the queue.

Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111105/34e2da91/attachment.htm>

More information about the erlang-questions mailing list