[erlang-questions] UDP buffers and packet loss

Adrian Roe roe.adrian@REDACTED
Fri Nov 18 22:59:42 CET 2016

We've had good success tweaking the kernel buffer sizes on servers with a lot of UPD traffic in the past. I found the following in an old shell script that might do the trick:

sudo sysctl -w net.core.rmem_max=8000000
sudo sysctl -w net.core.wmem_max=8000000
sudo sysctl -w net.ipv4.route.flush=1

- those change the read and write buffer sizes; there are a whole ton of other options, but we’ve found those two to be sufficient on servers with lots of UDP traffic in the past.  Google will no doubt tell you all the others if you’re bored ;)

Sent from my iPhone

> On 18 Nov 2016, at 21:18, pablo platt <pablo.platt@REDACTED> wrote:
> Hi,
> I have a UDP erlang media server running on Ubuntu 16.04 in a Virtual Private Server (VPS) with 100 connected clients.
> 10 clients send 1Mbps. Each packet is 1KB. 
> All clients receive 1Mbps.
> Every client has a pid that holds a gen_udp socket.
> I see packet loss on the clients. I'm trying to find what cause the packet loss and how to fix it.
> mtr -u <server> show no loss.
> netstat -su show that RcvbufErrors increases over time
> Does this means that packets are dropped between the linux kernel and Erlang?
> The socket is created with gen_udp:open(0, [binary, {active, once}])
> The default gen_udp socket settings my machine is:
> buffer = 8192
> recbuf = 16384
> sndbuf = 212992
> inet docs says that buffer should be larger than recbuf and sndbuf and will be set automatically but in my case it is smaller. Is this a problem?
> Does sndbuf has an effect on UDP socket or only TCP socket?
> What are the recommended settings for buffer, recbuf and sndbuf for 1Mbps UDP socket?
> Do I need to change the kernel settings as well?
> What else can cause packet loss?
> Thanks
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161118/cce829b5/attachment.htm>

More information about the erlang-questions mailing list