What is the protocol being used for sending/receiving messages in Elixir/Erlang?

Hi,

I’m a newbie to Elixir and I’m just going through the Programming Elixir book. One of the many fascinating things is nodes to connect to each other and the ability to pass messages between processes that can even cross machines.

I do have questions on the underlying protocol being used for the messaging. I’m assuming its TCP - but if the nodes are on the same underlying host, does it use shared memory for faster speed instead of going through TCP for local communication?

Also, it seems that connecting to nodes across a public network is not recommended because the cookie is sent plain text. Is this accurate?

Finally - are there any performance benchmarks on how much message throughput can be handled from a single node?

Thanks - and please point me to documentation if these questions are covered there.

2 Likes

A good place to start is the Distributed Erlang section in the Erlang reference manual.

IIRC the protocol involves sending data as External Term Format to remote nodes; for communicating with processes on the same node, the entire term → ETF → term conversion is skipped.

4 Likes

ELI5 on processes may also give some insight: Processes ELI5 — BEAM VM Wisdoms

3 Likes

Thanks. I still do not see any references to network protocols being used to communicate between nodes. I’d have to assume its tcp based.

Is it common to have nodes distributed across a network or is that design typically frowned upon?

You can find for info here : Erlang -- Distribution Protocol

It is common. Being distributed over ultiple machines is one of the goals of the design behind Erlang.

3 Likes

However Erlang originally wasn’t designed with distribution working over internet, it was originally meant to work over intranet in same DC (or even rack). Nowadays most of the issues are ironed out, but for example default distribution still use insecure connections and is not really secure to use without bunch of configuration (cookies aren’t security measure anymore).

3 Likes

But in a private network, the distribution is as safe as the network itself, right?

Yes, as any other plain text communication.

1 Like

Yes and for public networks you can also you encrypted distribution Erlang -- Using TLS for Erlang Distribution and you can even define your own logic if you don’t like SSL and TCP Erlang -- How to Implement an Alternative Carrier for the Erlang Distribution

1 Like