[erlang-questions] High memory consumption inside docker
Michał Muskała
michal@REDACTED
Tue Mar 29 14:01:04 CEST 2016
Hello everybody,
This is a followup from the elixir mailing list:
https://groups.google.com/forum/#!msg/elixir-lang-talk/TqIcSVkHBxs/N1nWRWW9BwAJ
There were several issues involved in that particular problem, but one
of them might be of interest to the people here as well, as it's
generally erlang-related rather than tied to elixir or any package in
particular.
The issue comes down to unusually high memory consumption for erlang,
specifically the system part from erlang:memory/0. The output below
shows values when running outside docker and inside:
Outside docker:
erl -eval 'io:format("~w~n", [erlang:memory()]), init:stop().' -noshell
[{total,15182640},{processes,3799768},{processes_used,3797720},{system,11382872},{atom,194289},{atom_used,169621},{binary,78344},{code,3868184},{ets,229416}]
Inside docker's official erlang image (debian based)
docker run --rm -it erlang:18-slim erl -eval 'io:format("~w~n",
[erlang:memory()]), init:stop().' -noshell
[{total,111303160},{processes,3799768},{processes_used,3797720},{system,107503392},{atom,194289},{atom_used,169584},{binary,595608},{code,3860673},{ets,239464}]
Inside minimal alpine linux erlang image
docker run --rm -it msaraiva/erlang erl -eval 'io:format("~w~n",
[erlang:memory()]), init:stop().' -noshell
[{total,111432888},{processes,3748312},{processes_used,3746312},{system,107684576},{atom,194289},{atom_used,169869},{binary,596568},{code,3847723},{ets,185296}]
As you can see all the values except for system are very similar, with
system being almost 10x as large. The issue is also consistent across
different images. While outside docker a simple shell uses around
15MB, inside docker it grows to 80MB.
I tried to investigate the issue further using recon, and it looks
like the excessive memory is allocated with ll_alloc, although I have
to admit I'm out of my depth here.
I'll be thankful for any help or indications where I could dig deeper.
Michał.
More information about the erlang-questions
mailing list