Interview Prep/Networking/Sockets, ports, TIME_WAIT and conntrack

A UDP metrics collector loses data under load, and `netstat -su` shows `receive buffer errors` increasing.

IntermediateTroubleshootingSockets, ports, TIME_WAIT and conntrack
Answer

Likely causes → Packets arrive faster than the app reads them; the socket receive buffer fills and the kernel drops new datagrams. UDP gives no backpressure, so the sender never knows.

Diagnose →

netstat -su | grep -iE 'receive buffer errors|packet receive errors'
nstat -az UdpRcvbufErrors UdpInErrors
ss -uamn 'sport = :8125'        # skmem: rb = buffer size, d = drops
sysctl net.core.rmem_max net.core.rmem_default

Fix → Raise the max and request a bigger buffer in the app (SO_RCVBUF), and read faster (more reader threads, SO_REUSEPORT to spread across sockets):

sudo sysctl -w net.core.rmem_max=26214400 net.core.rmem_default=8388608

Prevent → Alert on UdpRcvbufErrors; for data you can't lose, switch to TCP or a queue.

All Networking questions Roadmap: Networking for DevOps

More on Sockets, ports, TIME_WAIT and conntrack