[erlang-questions] UDP buffers and packet loss
Mon Nov 21 10:10:16 CET 2016
On 11/21/2016 09:49 AM, pablo platt wrote:
> @Raimo, I'll try increasing read_packets.
> How does increasing read_packets work compared to increasing recbuf?
> Both have the same effect only read_packets keep unhanded packets as Erlang messages while recbuf keep them as raw data?
> Do you have a suggestion how to check the effect of increasing it?
> How do I know if UDP packets where dropped on the network or on the buffer because my Erlang process didn't process them fast enough?
> How did you compare gen_socket with gen_udp?
> Before going the nif way, I want to be sure that it improves my throughput.
> Why a nif can handle more UDP packets than gen_udp? I thought that the Erlang code should be the bottleneck in both cases.
For one, I can force (as root) the recvbuf size to a very large value . Also, the architecture of gen_socket for receiving
packets is very different from gen_udp. With the later, the inet kernel is reading the data of the socket and sending you
a message with the data. With gen_socket you get a message telling you that data can be read from the socket and the you
have to call recv yourself. That gives you the opportunity to read all pending input without having to got through the
> On Mon, Nov 21, 2016 at 10:29 AM, Andreas Schultz <aschultz@REDACTED <mailto:aschultz@REDACTED>> wrote:
> On 11/19/2016 08:51 PM, Max Lapshin wrote:
> ah, it is receive?
> We had to write special port driver to receive 500 mbit/s of UDP video multicast
> With  I'm able to forward (receive and send) 500mbit/s on a single core. The
> interface itself is a port driver combined with a nif and works only on Linux
> (and maybe OSX), but the actual forwarding code is pure Erlang .
> : https://github.com/travelping/gen_socket <https://github.com/travelping/gen_socket>
> : https://github.com/travelping/gtp_u_edp/blob/master/src/gtp_u_edp_forwarder.erl
More information about the erlang-questions