My app is at almost 400MB of memory usage despite running very few processes, none of which are memory heavy. The only thing I can think of that might be a bit heavy are dependencies (elixir + npm) but I don’t see how they would be that heavy…
What are ways I can investigate why it eats up that much memory? Any known ways to optimize?
There is some clue on this thread.
We also have this tutorial onto how to connect observer on fly apps
A stock firecracker VM running a stock phoenix app will use around 180MB. Lubien’s recommendations will give you the most information, so I would recommend that route. You could also expose the LiveDashboard to prod and redeploy. If you want a super quick glance at things, you can
fly ssh console, then
/app/bin/my_app remote and run
:erlang.memory() which will let you know what the breakdown of memory usage is going:
Thank you all for your help!
Looking at the data, my total Erlang memory usage is at ~140MB (see below).
If I understand correctly, my total usage is thus ~180MB (firecracker VM running a stock phoenix app) + ~141MB (total Erlang memory) = ~321MB ?
There is still about 80MB not accounted for but it is a good start.
code memory usage is at ~57MB. The doc reads that it is “The total amount of memory currently allocated for Erlang code”. That is actually not clear to me, what do we call “Erlang code”? Is it the actual code I wrote + deps? 57MB seems high!
total: 141605360, (141MB)
processes: 49036760 (49MB),
system: 92568600 (92MB),
atom: 1515865 (1MB),
binary: 8457224 (8MB),
code: 56992902 (57MB),
ets: 9914712 (10MB)