[erlang-questions] minimizing the footprint of a running node
Kenneth Lundin
kenneth.lundin@REDACTED
Thu Oct 30 21:20:52 CET 2008
On Thu, Oct 30, 2008 at 8:19 PM, Joel Reymont <joelr1@REDACTED> wrote:
> I only have 3Gb of memory in my accelerator at Joyent and I'm trying
> to launch 10 nodes. beam starts with RSS of about 135Mb and quickly
> goes to 500Mb+.
>
> How can I minimize the footprint of my running nodes?
>
> I'm starting slaves like this:
>
> common_args() ->
> "+K true +P 134217727 -smp disable".
>
You will lower the memory footprint significantly by removing +P option or
using a much lower value for it (the number of simultaneously existing
processes that
the system can handle). I am pretty sure you don't need the maximum
value there, you will run out of memory in one node before you reach
134 millions of processes and I am
pretty sure that your system will not handle millions of simultaneous
poker players (in one Erlang-node)
The value +P 134217727 will result in a memory requirement of 4 times
134217727 bytes = 536870908 bytes = 536 Mbytes for the Erlang node
just to hold the process-table.
/Kenneth Erlang/OTP, Ericsson
> start_slave_node(Name, Args) ->
> case slave:start_link(net_adm:localhost(), Name, Args) of
> {ok, Node} ->
> timer:sleep(1000),
> %%mnesia:add_table_copy(schema, Node, ram_copies),
> rpc:call(Node, mnesia, start, []),
> rpc:call(Node, mnesia, change_config, [extra_db_nodes,
> [node()]]),
> timer:sleep(1000),
> Node;
> Reason ->
> io:format("Failed to start slave node: ~p. Retrying in 1
> second.~n",
> [Reason]),
> timer:sleep(1000),
> start_slave_node(Name, Args)
> end.
>
> And here's the output from top:
>
> load averages: 1.37, 2.75, 2.53; up 0+08:07:22
> 19:16:41
> 64 processes: 63 sleeping, 1 on cpu
> CPU states: 95.9% idle, 0.3% user, 3.8% kernel, 0.0% iowait, 0.0%
> swap
> Memory: 32G phys mem, 3899M free mem, 76G total swap, 75G free swap
>
> PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
> 7710 admin 3 1 0 551M 536M sleep 0:01 0.04% beam
> 7746 admin 1 59 0 5004K 2052K cpu/5 0:00 0.01% top
> 7578 postfix 1 59 0 6728K 4624K sleep 0:00 0.00% smtpd
> 7695 admin 3 1 0 547M 534M sleep 0:01 0.00% beam
> 7665 admin 3 14 0 547M 2572K sleep 0:02 0.00% beam
> 7638 admin 3 1 0 547M 329M sleep 0:01 0.00% beam
> 7740 admin 3 1 0 551M 537M sleep 0:01 0.00% beam
> 7607 admin 3 1 0 549M 536M sleep 0:07 0.00% beam
> 19718 root 13 59 0 4100K 1532K sleep 0:02 0.00% syslogd
> 7651 admin 3 19 0 547M 534M sleep 0:01 0.00% beam
> 7680 admin 3 1 0 547M 534M sleep 0:01 0.00% beam
> 19633 root 29 59 0 8748K 2552K sleep 0:00 0.00% nscd
> 7724 admin 3 1 0 551M 537M sleep 0:01 0.00% beam
> 19737 root 1 59 0 10M 2016K sleep 0:03 0.00%
> miniserv.pl
> 19762 root 1 57 0 2760K 1176K sleep 0:00 0.00%
> authdaemond
>
> Thanks, Joel
>
> --
> wagerlabs.com
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list