[erlang-questions] Worth minimizing the number of inter-node messages?

Stefan Hellkvist hellkvist@REDACTED
Thu Nov 23 08:49:31 CET 2017


Hi all enlightened people,

Suppose that you, in a distributed Erlang setup, have a process A, running
on one of the nodes, which, in its state, holds pids B1, B2, ..., Bn, where
each process B could be running on any of the nodes in the cluster. Suppose
further that you want to typically broadcast messages to all processes (B1
through Bn) - the same message to all processes (you can think of it as a
"group chat" if you like where "A" is the room and B1-Bn are the users
joining the room - seeing everything posted there - or you could see it as
a message bus for a topic "A"). The number n here could be in the order of
"2-10 thousands" and messages are typically not huge but perhaps not tiny
either (< 1kB).

In such a setup, if you want to minimize the time to distribute the message
to all processes B1 to Bn (the time between when the first B receives the
message to the last), would you consider it be worth to try to minimize the
amount of traffic between the nodes, by, let's say, grouping all processes
belonging to the same node and instead adding such groups to the process A?
Then there would be one message going between the nodes and then the local
groups on each node take care of sending it to all its local processes
(under the assumption that local message passing has a lower cost than
inter-node message passing). Is there even such library out there that does
something similar? I know of pg and pg2 but the goals of these modules is
not about minimizing node-to-node traffic if I understand them correctly.

Or perhaps others are approaching such broadcasting of messages in
different ways that does not rely on Erlang message passing at all - such
as relying on multicast or using message buses (such as Rabbit or NATS)?
Perhaps that is a better approach? I suppose "measuring" is the answer
here...but perhaps someone has done similar comparisons already?

/Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171123/c6bb4492/attachment.htm>


More information about the erlang-questions mailing list