Limitation on number of messages?

Peter Andersson <>
Tue Oct 24 14:18:54 CEST 2000


As far as I know there is no limit other than the system memory (no messages are
discarded) and it is not OS dependent. You have to verify yourself that this is
not a problem in your application. It can indeed be a problem. I've seen the
following a few times: A process has done a gen_server call to another process,
which, for some reason, does not reply (in time). Meanwhile the waiting process
receives incoming messages and after some time the Erlang node can not allocate
more memory for the queue. The result is that the node crashes with a report
like "Can not allocate ??? bytes of memory". What you wanted was really an error
report stating the reason for the missing reply! It is important you use a
timeout value in gen_server calls for making it possible to detect these types
of errors rather than getting a node crash. You might be tempted to use the
'infinity' setting for convenience, but be careful then. (Another benefit of
using relevant timeout values in calls is that you can detect performance
problems in early tests this way, i.e. use a short timer value at first to see
if you get the response times you expect, later set it up to a "safe worst-case"



Gerald Biederbeck wrote:
> Hi,
> i'm going to implement a gen_server.
> Scenario:
> Let's say the gen_server process is busy performing a handle_cast/2.
> Meanwhile I send messages to the server
>         -> the messages are queued!
> How many Messages will be queued? (number of messages)
> Is it possible that messages are discarded when the queue is full?
> What size is the Maximum of the Queue? (Bytes)
> Are there any limitations at all? (besides memory!)
> Is this dependent on the OS i'm using? (here: Unix)
> Are there known problems related to a large/long queue of messages (e.g.
> Performance)?
> I found nothing on the OTP-Doc page related to this topic.
>         -> maybe there is no problem at all!
> Thanx for any hint
> /Gerry

More information about the erlang-questions mailing list