<div dir="ltr">Hello,<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 3, 2016 at 5:23 PM, Max Lapshin <span dir="ltr"><<a href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@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">When we use plain gen_udp to accept 200-400 mbit of incoming MPEG-TS traffic in flussonic, we use about 50% of moderate 4 core xeon e3 server.</div><div class="gmail_extra"><br></div><div class="gmail_extra">When we switch to our driver implementation of udp that collapses several contiguous udp messages into single big message (it is allowed for mpegts) we reduce usage to 15-20%</div><div class="gmail_extra"><br></div><div class="gmail_extra">I can't tell that it is "badly written udp in erlang", just messaging is rather expensive.</div></div>
</blockquote></div><br></div><div class="gmail_extra">Do you think that it is the batching that makes the performance difference? In that case do you think adding an option to gen_udp that does batching would help enough? There is already read_packets as an option, and maybe it makes sense to have an option that batches all reads done by read_packets into one erlang message.</div><div class="gmail_extra"><br></div><div class="gmail_extra">i.e. you get something like:</div><div class="gmail_extra"><br></div><div class="gmail_extra">{udp_batch, Socket, IP, InPortNo, [Packets]}</div><div class="gmail_extra"><br></div><div class="gmail_extra">or possibly</div><div class="gmail_extra"><br></div><div class="gmail_extra">{udp_batch, Socket, [{IP, InPortNo, Packet}]}</div><div class="gmail_extra"><br></div><div class="gmail_extra">Lukas</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>