malaire

malaire

Overhead cost of using several Erlang VMs?

I’ve been learning about Elixir and it seems to be recommended that each project is packaged with its own Erlang VM. So if several projects are run on a single computer/VPS, this means that there would be several Erlang VMs running on that computer/VPS.

Are there any (recent) articles/posts/discussions about overhead cost (CPU/RAM) of using several Erlang VMs instead of single one?

I’m thinking of computer/VPS with 1-2 CPUs, so context switching will cause some CPU overhead,
and there is of course also some RAM overhead.

Most Liked

dimitarvp

dimitarvp

I’d think that having 2+ BEAM VMs live on the same physical server is going to demonstrate some lags and struggles in parallel workflows because each VM will try to utilize X processor cores (where X equals System.schedulers_online() which can be modified at startup). If each of the VMs is started with schedulers equal to all processor cores, and in loaded parallel workflows, then you’re going to see contention.

But then that applies to each and every other runtime out there.

If you want to split a single VPS or physical server to several BEAM VMs, you better divide the CPU cores fairly between them and utilize OS tools to allocate the right cores to the right BEAM VM.

…Or, as others said, just use a single BEAM VM for all your apps at once – assuming none of them is aggressively modifying other processes’ state or in general being a bad citizen.

harmon25

harmon25

Hmm not sure I have heard that. Do you have a link regarding a VM per app? Maybe If the apps are entirely unrelated and this is a data isolation mechanism, sure.

Think many of us would agree the BEAM is more similar to an operating system than a language runtime…

Erlang has the concept of apps. A single Erlang cluster or VM can run probably thousands if not millions of ‘apps’ all effectively sharing system resources. Apps I believe are considered stateful in that BEAM processes are included. This state is what separates an Erlang app, from just module with functions…

For example, you could have n many phoenix endpoints in the same VM as long as they are bound to different OS ports.

I’m sure that’s not 100% accurate but is probably close enough…

Please people smarter than me correct, if I am wrong :stuck_out_tongue:

lud

lud

If you have BEAM installed on your VPS you can run all your application with this local installation.

But that does not mean that those apps will run in the same runtime, just like if you run two elixir app on two terminal windows on your computer. They do not communicate by default.

So my bet is that that would not change CPU/RAM consumption.

That being said, if you do releases that package their own Erlang runtime, you can have different versions of it, your app is portable so you can change hosting easily once you are set up, etc.

Where Next?

Popular in Questions Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41989 114
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement