stefanchrobot

stefanchrobot

Elixir memory usage

I’ve been looking at my application in terms of resource usage. It’s a simple SQS consumer that calls some APIs and is under a very small load. BEAM constantly reports usage of around 70MB of memory:

I’m not sure what to think about it. Honestly, I expected a smaller footprint. I’m running with the default settings and simple MIX_ENV=prod mix run.

Is there an easy way to shave off some memory? Also, I’m wondering - why so many atoms are used?

Most Liked

jeremyjh

jeremyjh

Each module, and every function in every module is an atom. If you are loading a few libraries hitting 22K isn’t too hard. I’m not sure what to think of the memory. Its not so bad compared to other high-level language VMs though is it? I’m sure Go or Rust would be a lot smaller but a better comparison is Ruby, Python or Java.

jeramyRR

jeramyRR

70 MBs seems a bit high for a small app. What all libs are you loading?

The image below shows a basic Phoenix app.

jola

jola

If you do try building a release, I’m curious to see what the memory usage turns out to be. I made a quick comparison in a project of my own and also just a plain new phoenix project, in both cases memory use was much higher in the release. Why do releases use so much more memory than `mix run`? - #2 by michalmuskala

As I point out though, my comparison may be unfair, as not all code is necessarily loaded in the mix version when I checked memory use, while releases preload all modules. But you should be able to get an accurate comparison.

Where Next?

Popular in Questions Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
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
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
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
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
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
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement