[erlang-questions] minimizing the footprint of a running node

Joel Reymont joelr1@REDACTED
Thu Oct 30 20:19:48 CET 2008


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".

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








More information about the erlang-questions mailing list