By demelt
Hi. I’m running a UDP server on a single droplet using Node’s dgram module, and it functions well, but sometimes it will abruptly stop receiving all messages from my test client. I think it first happened when I sent a large surge of messages (around 128/s). I restarted the server, but it took a few minutes for it to start receiving them again, and it would abruptly stop them receiving again after a minute or so. I tried throttling the messages to 3-4 times a second (only a single client is sending, so that’s 3-4 messages/s total) and the stopping still happens. The messages were only 6 bytes in length.
I know UDP has a chance to drop packets. Is this an instance of that? Or could it be something else? Are there some settings I can alter in Nginx, PM2, or my Droplet to prevent this from happening? For my server I’ll likely have many clients connected, all sending small packets of bytes several times a second.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey friend,
That is the fun thing about UDP, the lack of knowledge of what happens when the system doesn’t really care. Personally I don’t use UDP traffic for anything but DNS, but I found some resources that might be helpful:
https://medium.com/@CameronSparr/increase-os-udp-buffers-to-improve-performance-51d167bb1360 https://jvns.ca/blog/2016/08/24/find-out-where-youre-dropping-packets/ https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Web_Platform/5/html/Administration_And_Configuration_Guide/jgroups-perf-udpbuffer.html
Hope some of that proves at least somewhat helpful :)
Jarland
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
