<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 23, 2015 at 6:03 PM, Lukas Larsson <span dir="ltr"><<a href="mailto:garazdawi@gmail.com" target="_blank">garazdawi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><br></div><div class="gmail_quote"><div>With a recon_alloc:memory(usage, current) value of 65 - 70%, this difference is expected. What is happening is that the memory allocators of the VM is not finding any good slots to put new heaps in, so it keeps requesting more memory from the OS. erlang:memory reports used memory, which is not the same as the memory requested from the OS. recon_alloc:memory(allocated, current) reports something very close to what has actually been requested from the OS, which is why this value is much closer to what you see with top.</div><div><br></div><div>It would be interesting to see if you get the same results if you start the VM with "+Muacul 0", or if you get better utlization if you use that. If you want to know what it is that you are disabling you can read this: <a href="https://github.com/erlang/otp/blob/master/erts/emulator/internal_doc/CarrierMigration.md" target="_blank">https://github.com/erlang/otp/blob/master/erts/emulator/internal_doc/CarrierMigration.md</a>.</div><span class=""><font color="#888888"><div><br></div><div>Lukas</div></font></span></div></div></div></blockquote><div><br></div><div>Hi again,</div><div>I had the time to try the <font face="monospace, monospace">+Muacul 0</font> option you suggested. It actually works pretty well since the RAM usage ratio (erlang / VM) improves considerably.</div><div><br></div><div>Unfortunately both with or without the option I am getting the same problem: the machine seems stable, but at a certain moment *within 30 seconds* the VM memory usage suddenly increases from 11GB to 15GB until it crashes.</div><div><br></div><div>I don't get it because the erlang usage is *very* stable now, I always get this kind of data:</div><div><br></div><div><div><font face="monospace, monospace">1> [{K,V / math:pow(1024,3)} || {K,V} <- erlang:memory()].</font></div><div><div><font face="monospace, monospace">[{total,8.803221724927425},</font></div><div><font face="monospace, monospace"> {processes,7.404303453862667},</font></div><div><font face="monospace, monospace"> {processes_used,7.404133327305317},</font></div><div><font face="monospace, monospace"> {system,1.3989182710647583},</font></div><div><font face="monospace, monospace"> {atom,0.0015203068032860756},</font></div><div><font face="monospace, monospace"> {atom_used,0.0015129167586565018},</font></div><div><font face="monospace, monospace"> {binary,0.9653719812631607},</font></div><div><font face="monospace, monospace"> {code,0.049161157570779324},</font></div><div><font face="monospace, monospace"> {ets,0.007966354489326477}]</font></div></div><div><br></div><div>I see consistent total, process and binary usage. Unfortunately the ratio falls:</div></div><div><br></div><div><div><font face="monospace, monospace">2> recon_alloc:memory(usage, current).</font></div><div><font face="monospace, monospace">0.7353255106318904</font></div></div><div><br></div><div>..after a while:</div><div><br></div><div><div><font face="monospace, monospace">3> recon_alloc:memory(usage, current).                    </font></div><div><font face="monospace, monospace">0.5630988225908702</font></div></div><div><br></div><div>Why is the VM so eager on memory if the underlying erlang usage is stable?</div><div><br></div><div>Is there anything I can do? I honestly don't know where else to look.</div><div><ul><li>Binaries are optimized (checked with <font face="monospace, monospace">+bin_opt_info</font>).<br></li><li>Erlang reported memory for <font face="monospace, monospace">total</font>, <font face="monospace, monospace">process</font> and <font face="monospace, monospace">binary</font> is linear.</li><li>I'm using some gimmicks like <font face="monospace, monospace">fullsweep_after 10</font> as a system flag.</li><li>I hibernate the long living TCP connections (which is where the problem comes from, since I ran tests on short lived connections and had no issues).</li></ul></div><div>Any help would be greatly appreciated.</div><div><br></div><div>Best,</div><div>r. </div></div><br></div></div>