Take the 2-minute tour ×

Hi I am implementing an IM-server-like application in Erlang. I used one agent process for each client connecting to the server, and the agent process is responsible for sending the messages to a message gateway, which in turn sends the message to another agent process. It seems that erlang inter-process messaging is implemented as tcp connections. So there will be one connection for each agent process to the gateway. Does this mean that the number of agents on a single machine will never exceed over 65,535 due to the restriction of port numbers?

Thanks in advance!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Some limits for Erlang: Efficiency Guide User's Guide / 10 Advanced:

Distributed nodes Known nodes A remote node Y has to be known to node X if there exist any pids, ports, references, or funs (Erlang data types) from Y on X, or if X and Y are connected. The maximum number of remote nodes simultaneously/ever known to a node is limited by the maximum number of atoms available for node names. All data concerning remote nodes, except for the node name atom, are garbage-collected.

Connected nodes The maximum number of simultaneously connected nodes is limited by either the maximum number of simultaneously known remote nodes, the maximum number of (Erlang) ports available, or the maximum number of sockets available.

share|improve this answer
add comment

Erlang connects Erlang nodes over the network, not Erlang processes. (And each Erlang node is an Operating System process).

So you will run out of TCP connections when you have several dozen Ks of Erlang nodes on a single machine (which is unreasonable), not when you have several dozen Ks of Erlang processes on a single Erlang node.

(I am not giving any absolute numbers as each Erlang node will also need to communicate with epmd which produces another network connection. But you will probably not have 30+K of Erlang nodes aka OS processes on a single machine anyway.)

share|improve this answer
Erlang nodes are connected in full mesh, so the 64K stands for all connected nodes in the network, not on a single node. Having that many nodes would also be unreasonable though :) –  Zed Nov 8 '10 at 10:10
Well if the IM thing takes of and needs to run on more than 64k CPU cores ... ;-) –  Peer Stritzinger Nov 8 '10 at 10:17
Thanks a lot! I found that it is true when processes are connecting over different machines. However when they are on the same machine each process consumes a tcp connection via to epmd? ). That seems to be not much a problem since the loop-back addresses are abundant :) –  Chi Zhang Nov 11 '10 at 1:25
add comment

Your Answer


