saleh-tekm
Hi everyone,
I’m relatively new to Elixir/Erlang, and I’m working on a demo project. The setup involves a master supervisor, a supervisor, and a worker, and I need to run each of them on separate devices. I’m unsure how these components will communicate when they’re on different machines.
To tackle this, I created separate projects for each component and connected them using Node.connect() and Phoenix.PubSub. However, I realized that this approach doesn’t handle supervision properly, right?
I feel like I might be lacking in the fundamentals of Elixir/Erlang, and I’d really appreciate some guidance on how to implement this correctly.
Thanks in advance! ![]()
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Hermanverschooten
What is your intention with this supervision?
LostKobrakai
While process links can span across nodes usually supervision and supervision trees are a thing local to a single node.
saleh-tekm
To have a control over the child node and restart the child it if it dies. To ensure fault tolerance…But I dont know if it is the thing that is possible if project is setup at multiple nodes / interproject, like different projects at different nodes.
Im sorry if Im wrong at fundamentals itself.
Hermanverschooten
Why not keep it local? Supervision on the node?
dimitarvp
What you need, I am not sure even Kubernetes has. It has some capabilities of distributed orchestration but I don’t think it can do OTP-like supervision.
It helps to zoom out and ask yourself why do you need something that almost no technology is offering (not stably and bulletproof anyway).
asabil
This is of course possible, here is a crude example in Erlang:
The only thing a supervisor care about is a that a child start function starts a new process, liinks it to the supervisor and return the
{ok, Pid}(or{ok, Pid, Info}), the Pid can be started on a remote node as the example above show.Here is an example session:
As you can see in the last line, the supervisor restarted the process on the remote node.
That being said, you might probably want to take a look at the distributed applications guide for your use case (Distributed Applications — Erlang System Documentation v29.0.2)
Hope this helps.
dimitarvp
Cool, I am grateful that you showed this. I stand corrected.
I still would not want to have this in the split-brain scenarios but then again, I am not sure any other software stack would deal better with it than Erlang.
sbuttgereit
My sense is that a distributed application that is fault tolerant is a different thing from a distributed fault tolerance mechanism. A distributed application that is fault tolerant seems a reasonable and achievable goal (with some limitation), but a distributed fault tolerance mechanism I feel like could never be better than “fragile” or “unreliable” across too many scenarios.
I can see maybe having a specific, maybe more robust, device taking a role as some sort of controller node for commanding distributed processes to start, shutdown (gracefully) as needed, or just to monitor status… but not in the sense of supervision trees, but in the sense that the child processes can receive messages from the central node and that send responses as needed.
For fault tolerance and supervision… I’d be inclined to keep all of that local to the node. To my knowledge it solves a lot of questions distributed supervision might leave you with. What happens if the communication (network) between the child and supervisor isn’t working? Does the child have to detect this and die (self-supervision)? If the supervisor on node a doesn’t see the child in the right time (again, maybe network), does it try to restart the remote child and if the remote child isn’t actually dead is that OK?
I think if I’m really needing something like this, I’m going beyond just baseline OTP, am not really very familiar with OTP, the first thing I’m going to look for is a library (GitHub - elixir-horde/horde: Horde is a distributed Supervisor and Registry backed by Postgres · GitHub, maybe GitHub - bitwalker/libcluster: Automatic cluster formation/healing for Elixir applications · GitHub, etc.) built by others that are better versed in the issues. At least study them to get a handle on it.
I need to disclaim something here: I don’t have much hands-on experience with this in the Elixir/Erlang context so my thinking could well be flawed… but having worked with these kinds of distributed things before I have some instincts for it.
asabil
That’s what linking does, the linking is bidirectional, so if the link is severed between the processes, both processes receive an
exitsignal. What makes supervisors special is that theytrap_exit. In this scenario it will mean that the child will terminate if the supervisor is no longer reachable.The supervisor will also receive an exit signal if the child is no longer reachable, but instead of terminating it will attempt to start a new child to replace the old one. Now if that fails many times, the supervisor itself will fail.This of course doesn’t have to span networks. It could be 2 separate nodes on the same machine, or separate machines connected directly with an Ethernet/serial cable, it really all depends on the topology of the system.
All in all, the most important is to define/understand the failure modes and possibilities of your system. Is there a network? Is the network a possible problem? Is hardware failure a possibility you want to handle? Can someone yank a cable?
Once understood, you can build the right mechanism to handle the failures. No system can handle every single possible failure.
lud
Don’t do that.
If your supervisor starts a child, the child will belong to the supervisor’s node for process groups. For instance it’s IO.puts and other IO will go through the supervisor node. You will have to do a lot of stuff just to get to a normally operating system.
And if you turn off your worker device, the supervisor will quickly reach max restarts and crash your app, or maybe crash the master supervisor app.
I’m sure there are countless other problems we can find just by experimenting with this, plus the security problems.
If you need supervision, do it locally, and if you need to keep sync with another device, connect the nodes and use
:net_kernel.monitor_nodesto know when you are disconnected. Or sync with TCP for instance.Anyway, this is just my recommendation, of course it’s fun to play with distribution in unconventional setups. But if it’s a serious project I would strongly suggest to find another solution.