How does distributed (across different machine) messaging work in Erlang/Elixir?

So we have processA running on machineA and processb running on machineB; and the two are connected via distributed Erlang.

Now, processA sends processB a message. What happens? Is Erlang/Elixir creating a new tcp/udp connection from machineA to machineB, or is there some pre-existing tcp/udp connection between machineA/B that gets used ?

Pre-existing. Erlang’s distribution mandates persistent connections between each node in the mesh (star topology if memory serves) as soon as the VM is started, at least by default. There was another setting that reduces the total number of connections but the idea stays the same, more or less.


Some of it is described in Erlang -- Distribution Protocol