<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi erlang experts,</div><div><br></div><div>I did a testing about tcp connection.</div><div>The scenario is simple:</div><div>1) start two erlang nodes (let us say "node C" and "node S") with flag "+Mim true" to enable the instrument;</div><div>2) on "node S" I start a TCP server which accepts connections;</div><div>3) on "node C" I spawn 10000 processes to connect to "node S"; all the connections were successful;</div><div>4) I use instrument to lookat the "drv_binary" and "binary" memory status, I found on "node S", there was a 419461 bytes drv_binary item</div><div>   corresponded to <span style="color: rgb(255, 0, 0);">per</span> TCP connection; but there was <span style="color: rgb(255, 0, 0);">NOT</span> a same drv_binary item on "node C".   The total memory usage on "node S"</div><div>  is 419461 * 10000, about 4G, too huge.</div><div><br></div><div> My question is: who allocated the 419461 drv_binary memory?</div><div><br></div><div>This is the tcp options on "node S" I used:</div><div><p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">-define(<span style="color: rgb(0, 0, 0);">TCP_OPTS</span>, [</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    binary,</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {backlog, <span style="color: #6d71c1">256</span>},</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {packet, <span style="color: #6d71c1">0</span>},</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {active, false},</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {reuseaddr, true},</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {nodelay, false},</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {delay_send, true},</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {keepalive, true},</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {send_timeout, <span style="color: #6d71c1">60000</span>},</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">    {exit_on_close, true}</p>
<p style="margin: 0px; font-size: 16px; line-height: normal; font-family: Consolas;">]).</p></div><div>  </div><div>This is the memory status that I use instrument:memory_data/0 and  instrument:descr/1 to lookat:</div><div><span style="color: rgb(255, 0, 0);">[ .......</span></div><div><span style="color: rgb(255, 0, 0);">  .......</span></div><div><span style="color: rgb(255, 0, 0);">  ........ </span></div><div><span style="color: rgb(255, 0, 0);">{drv_binary,2737203904,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2743914464,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2746012024,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2746851048,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2748109584,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2751883560,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2753561608,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2753981120,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2760691680,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2761111192,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2762789240,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2764047776,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2778307920,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2781244504,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2787955064,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2789633112,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2790052624,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2796343672,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2809764792,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2810603816,419461,undefined},</span></div><div><span style="color: rgb(255, 0, 0);"> {drv_binary,2813540400,419461,undefined}]</span></div><div><span style="color: rgb(255, 0, 0);"><br></span></div><div><span style="color: rgb(0, 0, 0);">Thanks very much.</span></div><div><span style="color: rgb(0, 0, 0);"><br></span></div></div><br><br><span title="neteasefooter"><p> </p></span>