📎 Webclip
Introduction to Distributed Messaging with Elixir
Elixir inherits distributed messaging from Erlang, so nodes can connect across racks, data centers, and oceans. The article uses that to show how real-time software can keep growing beyond hardware boundaries while dealing with latency and failure.
Reading notes#
- Two IEx nodes can be started with different
snamevalues, pinged withNode.ping/1, and checked withNode.list/0. - A function compiled on one node can be called from another node with Erlang’s
:rpc.call/4. - The tutorial builds separate
ServerandClientapplications that talk to each other natively. - The server keeps a stack and a subscriber list, and registers itself globally with
:global.register_name/2so other nodes can find it. - The client connects to the server with
:global.whereis_name/1, subscribes to updates, and logs stack changes in a separate process. - Pushing, popping, requesting the stack, and unsubscribing are all sent as messages across nodes.
- The same setup works in real time whether the nodes are on one machine or on different cities or continents.
