<div><div class="gmail_quote"><div dir="auto">Hi guys,</div><div dir="auto"><br></div><div dir="auto">I would like to thank you for your feedbacks and pointers.</div><div dir="auto"><br></div><div dir="auto">After days of unsuccessful investigations, Jesper’s hint led me directly the culprit.</div><div dir="auto"><br></div><div dir="auto">All clients were sending small binaries to my app, but one. This one guy sent very large binaries for very long time (keep-alive).</div><div dir="auto"><br></div><div dir="auto">A temporary workaround was to simple limit the size of each binary sent and force closing TCP connection after N seconds.</div><div dir="auto"><br></div><div dir="auto">The memory usage went immediately back to ~160MB.</div><div dir="auto"><br></div><div dir="auto">Thanks again </div><div>/Frank</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Fred's excellent "Erlang In Anger" book (<a href="https://www.erlang-in-anger.com/" target="_blank">https://www.erlang-in-anger.com/</a>) has a section on hunting down binary leaks (if that is what you are working with here). At least this can give you some starting information about what to look for and how to go about handling it afterwards. Identifying which processes are holding the binary data by extension identifies the code modules which are culprits.<br><br></div>Since your normal operation uses 160 megabytes of memory and it suddenly shoots to gigabytes, one of the parts is to identify what is being done to the system when that happens. Perhaps you have an outside user which uses your system in a way that wasn't thought about originally. This can lead to you handling different data and in turn this can expose some of these problems.<br></div><br><div class="gmail_quote"><div>On Mon, Nov 13, 2017 at 9:23 AM Frank Muller <<a href="mailto:frank.muller.erl@gmail.com" target="_blank">frank.muller.erl@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="gmail_quote"><div>Hi Jesper,</div><div dir="auto"><br></div><div dir="auto">Thanks again for the feedback.</div><div dir="auto"><br></div><div dir="auto">But from where should I start (Erlang newbie here)? </div><div dir="auto">I’ve no idea ... is there a guideline to follow?</div><div dir="auto"><br></div><div dir="auto">I feel guessing without making any real progress for the last two days :-/</div></div></div><div><div class="gmail_quote"><div dir="auto"><br></div><div dir="auto">/Frank</div></div></div><div><div class="gmail_quote"><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>First quick stab:<div><br></div><div>Most of the allocated space is binary() data.</div><div><br></div><div>Typical scenario: something is keeping the binary() data alive, one way or the other. Either because you need a binary:copy/1 in key locations due to sub-binaries, or because your system can't get rid of the data since you still have a pointer kept to it from some process.</div><div><br></div></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div>On Sun, Nov 12, 2017 at 12:51 PM Frank Muller <<a href="mailto:frank.muller.erl@gmail.com" target="_blank">frank.muller.erl@gmail.com</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">Hi guys,</span><br style="color:rgb(49,49,49);word-spacing:1px"><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">I’ve a fairly complex I/O bound Erlang application.</span><br style="color:rgb(49,49,49);word-spacing:1px"><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">Since yesterday, the beam.smp memory usage dramatically increased from ~160MB to something between [2.5GB,  3.1GB].</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">I’ve no idea how, nor why :-/</span><br style="color:rgb(49,49,49);word-spacing:1px"><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">Attached is snapshot taken with recon_alloc:snapshot().</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">Please let me know if you want anything else.</span><br style="color:rgb(49,49,49);word-spacing:1px"><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">Hope someone can explain me what’s going on.</span><br style="color:rgb(49,49,49);word-spacing:1px"><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">Thank you.</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">/Frank</span><br style="color:rgb(49,49,49);word-spacing:1px"><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">INFO:</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">. Physical machine (not a VM)</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">. Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">. CentOS-7-x86_64</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">. Linux ns342284 4.9.58-xxxx-std-ipv6-64 #1 SMP Mon Oct 23 11:35:59 CEST 2017 x86_64 x86_64 x86_64 GNU/Linux</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">. 8x Intel(R) Xeon(R) CPU  E5504  @ 2.00GHz</span><br style="color:rgb(49,49,49);word-spacing:1px"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">. 16GB of RAM</span><br style="color:rgb(49,49,49);word-spacing:1px"><div dir="auto"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)"><br></span></div><div dir="auto"><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)"><br></span></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>
</blockquote></div></div></blockquote></div>
</blockquote></div></div>