My guess is that this assumes you want to establish the cluster immediately which would be the common case perhaps. For more dynamic clusters where it is fine if members come and go, because the clustering is non-critical, are there particular reasons to avoid this? It is mentioned as an option for debugging. Are there significant drawbacks there or is the documentation just a bit opinionated in usage of the functionality?
Not sure if I understand the question fully. That piece of documentation talks about assumptions that an alternative distribution implementation can make.
Boot script is absolutely necessary to run Erlang (Ericsson’s implementation), because it sets up paths, loads kernel modules etc… You don’t have to create your own boot script (although it is created when you make a release).
The implementation can be debugged by starting the distribution when all the system is running, but in a real system the distribution is to start very early …
So presumably it can be loaded at runtime. If so, why is this not appropriate for a production system? Why should it start early? Is there some assumption made that I am missing? Could a distribution mechanism that is loaded later depend on other packages?
Yes it can, but you’d need to start the distribution manually, via net_kernel:start. It’s a relatively advanced technique, and you need to understand the implications.
That’s fair. I’ve certainly done that in tests and maybe even on some hobby devices.
Can I read more about the implications somewhere?
I kind of assume it is mostly a problem if the clustering is of critical importance.
I am thinking of experimenting with it for Nerves devices, so embedded. And primary concerns are that they start, connect to their network and establish their connection to NervesHub for updates.
Attempting to cluster them would be a later concern and not nearly as critical. The way that passage is written I get the impression that it would be bad to do start clustering later and that it should only be used for debugging. And that seems like it might be an exaggeration. But it made me think that maybe there are performance penalties or other concerns that are non-obvious.
The way I read it, “some OTP applications may rely on distribution available prior to their startup”.
I can imagine that mnesia relies on node being distributed when the application start. So that if you’re using releases, you’d need to ensure that distribution starts before mnesia.