<html><head><base href="x-msg://880/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Have you considered switching from 32-bit erlang to 64-bit?<div><br></div><div>V/</div><div><br><div><div>On 17 Jan 2014, at 12:37 PM, Saltanov, Alexey wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><font face="Calibri" size="2"><span style="font-size: 11pt; "><div>I have simple Erlang echo server:</div><div><font face="Courier New">loop() -></font></div><div><font face="Courier New"> receive</font></div><div><font face="Courier New"> {From, Request} -></font></div><div><font face="Courier New"> erlang:send(From, Request),</font></div><div><font face="Courier New"> loop()</font></div><div><font face="Courier New"> end.</font></div><div>This echo server started on the Server1.</div><div> </div><div>And I have some client application (Basho Bench test):</div><div><font face="Courier New">run(send, _KeyGen, ValueGen, State) -></font></div><div><font face="Courier New"> Msg = ValueGen(),</font></div><div><font face="Courier New"> erlang:send(State#state.address, {{State#state.reg_name, node()}, {self(), Msg}}),</font></div><div><font face="Courier New"> {ok, State}.</font></div><div>Wihich sends many messages to the echo server.</div><div> </div><div>When I started client application on the Server2 I've found the crash of the echo server.</div><div><font face="Courier New">=erl_crash_dump:0.2</font></div><div><font face="Courier New">Wed Jan 15 17:04:26 2014</font></div><div><font face="Courier New">Slogan: eheap_alloc: Cannot allocate 949152844 bytes of memory (of type "heap").</font></div><div><font face="Courier New">System version: Erlang R16B02 (erts-5.10.3) [source] [64-bit halfword] [smp:8:8] [async-threads:10] [kernel-poll:false]</font></div><div><font face="Courier New">Compiled: Wed Dec 11 16:19:29 2013</font></div><div><font face="Courier New">Taints: crypto</font></div><div><font face="Courier New">Atoms: 16134</font></div><div><font face="Courier New">=memory</font></div><div><font face="Courier New">total: 4131605472</font></div><div><font face="Courier New">processes: 2386433264</font></div><div><font face="Courier New">processes_used: 2386409264</font></div><div><font face="Courier New">system: 1745172208</font></div><div><font face="Courier New">atom: 463441</font></div><div><font face="Courier New">atom_used: 446760</font></div><div><font face="Courier New">binary: 501624</font></div><div><font face="Courier New">code: 11870105</font></div><div><font face="Courier New">ets: 274696</font></div><div><font face="Courier New">low: 3429068696</font></div><div> </div><div>But the Server1 had 30 Gb free RAM and 16 Gb free swap space before I started the echo server,</div><div>and I saw with the "top" command that my echo server allocated only 5 Gb RAM and really used only about 2 Gb.</div><div>Why the message queue cannot use more server memory?</div><div> </div><div>Some information about the Server1 configuration.</div><div><font face="Courier New">$ uname -a</font></div><div><font face="Courier New">Linux 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux</font></div><div><font face="Courier New"> </font></div><div><font face="Courier New">$ cat /etc/redhat-release</font></div><div><font face="Courier New">Red Hat Enterprise Linux Server release 6.3 (Santiago)</font></div><div><font face="Courier New"> </font></div><div><font face="Courier New">$ top</font></div><div><font face="Courier New">top - 12:27:01 up 2 days, 22:14, 1 user, load average: 0.00, 0.00, 0.00</font></div><div><font face="Courier New">Tasks: 310 total, 1 running, 309 sleeping, 0 stopped, 0 zombie</font></div><div><font face="Courier New">Cpu(s): 0.1%us, 0.1%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st</font></div><div><font face="Courier New">Mem: 33011268k total, 868152k used, 32143116k free, 132708k buffers</font></div><div><font face="Courier New">Swap: 16777208k total, 0k used, 16777208k free, 172772k cached</font></div><div> </div><div>I also tested memory allocation for the big binary data on the same Server1 node:</div><div><font face="Courier New">Erlang R16B02 (erts-5.10.3) [source] [64-bit halfword] [smp:8:8] [async-threads:10] [kernel-poll:false]</font></div><div><font face="Courier New">Eshell V5.10.3 (abort with ^G)</font></div><div><font face="Courier New">1> Z1=fun(N)-> X=lists:map(fun(I)-> binary:copy(<<1>>,1073741824) end, lists:seq(1,N)), io:format("mem: ~p~n", [memory()]), length(X) end.</font></div><div><font face="Courier New">#Fun<erl_eval.6.80484245></font></div><div><font face="Courier New">2> Z1(10).</font></div><div><font face="Courier New">mem: [{total,10758494488},</font></div><div><font face="Courier New"> {processes,4659176},</font></div><div><font face="Courier New"> {processes_used,4659176},</font></div><div><font face="Courier New"> {system,10753835312},</font></div><div><font face="Courier New"> {atom,194289},</font></div><div><font face="Courier New"> {atom_used,174684},</font></div><div><font face="Courier New"> {binary,10737518424},</font></div><div><font face="Courier New"> {code,4012558},</font></div><div><font face="Courier New"> {ets,172744},</font></div><div><font face="Courier New"> {low,4057440}]</font></div><div><font face="Courier New">10</font></div><div><font face="Courier New">3>Z2=fun(N)-> X=lists:map(fun(I)-> binary:copy(<<1>>,1024) end, lists:seq(1,N)), io:format("mem: ~p~n", [memory()]), length(X) end.</font></div><div><font face="Courier New">#Fun<erl_eval.6.80484245></font></div><div><font face="Courier New">4>Z2(10485760).</font></div><div><font face="Courier New">4> Z2(10485760).</font></div><div><font face="Courier New">mem: [{total,11973197304},</font></div><div><font face="Courier New"> {processes,795606312},</font></div><div><font face="Courier New"> {processes_used,795606312},</font></div><div><font face="Courier New"> {system,11177590992},</font></div><div><font face="Courier New"> {atom,194289},</font></div><div><font face="Courier New"> {atom_used,174744},</font></div><div><font face="Courier New"> {binary,11161273768},</font></div><div><font face="Courier New"> {code,4012558},</font></div><div><font face="Courier New"> {ets,172744},</font></div><div><font face="Courier New"> {low,4057440}]</font></div><div><font face="Courier New">10485760</font></div><div> </div><div>And this test completed successfully. But on the same server my echo server crashes when it is used only 4 Gb of the memory.</div><div>Has the messages queue its own limit?</div><div> </div></span></font>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br></div></span></blockquote></div><br></div></body></html>