[erlang-questions] Multiple BEAM nodes on one Linux node — a thought experiment
Wed May 15 10:40:35 CEST 2019
On Tue, 14 May 2019 at 22:12, Lloyd R. Prentice <lloyd@REDACTED> wrote:
> Is it possible/practical to run multiple BEAM nodes on a single Linux node?
Yes. We do this. IoT devices connect to one node; their backend
agents/actors run in a different node on the same machine, connected
by Erlang distribution. We do this for isolation (partly because
there's a large and complex NIF in the second node), plus for
historical reasons -- which we periodically revisit and decide "nah,
not worth the effort".
> Assume each BEAM node supports an identical web application with a Mnesia backend serving a set of CRUD services— each for a different client.
However: I wouldn't bother doing this. It won't scale beyond, say, a
few dozen nodes -- depending on the size of the host -- and you'd be
wasting a bunch of capacity on the host (remember that Unix process
overhead is several orders of magnitude more than Erlang process
overhead, and both are dwarfed by container overhead).
You'd be better served by looking at making a single node multitenant.
You could do this by using a separate mnesia table per client, or use
prefixed keys within whatever tables you're planning to use. Or use a
relational model, where each entity has a related owner.
More information about the erlang-questions