<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hello Roberto</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Fri, Jan 23, 2015 at 5:25 PM, Roberto Ostinelli <span dir="ltr"><<a href="mailto:roberto@widetag.com" target="_blank">roberto@widetag.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"><span class=""><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"><span><div class="gmail_extra">It is only a hunch. Clearly, something is using more memory than you expect, and I assume you have made calculations which shows that this memory usage is excessive given the number of processes and the specific profile of the system. Running 20000 SSL sockets will have some overhead due to SSL, so it is important to figure out if the memory usage is normal or unexpected in the first place.<br></div></span></div></div></blockquote><div><br></div></span><div>The main question here is: why is there such a difference between what the BEAM uses, and what Erlang VM uses. </div></div></div></div></blockquote><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"><div><br></div><div>In another (bigger) test I am now seeing erlang:memory reporting a total of 10 GB, while the BEAM eats up to 15 GB.</div><span class=""><div><br></div></span></div></div></div></blockquote><div><br></div><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">https://github.com/erlang/otp/blob/master/erts/emulator/internal_doc/CarrierMigration.md</a>.</div><div><br></div><div>Lukas</div></div></div></div>