question about inter-process messaging
H开发者_开发知识库i 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!
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.
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.)
精彩评论