I have a hypothesis: sometimes TCP connections arrive faster than my server can accept()
them. They queue up until the queue overflows and then there are problems.
How can I confirm this is happening?
Can I monitor the length of the accept queue or the number of overflows? Is there a counter exposed somewhere?
Best Answer
To check if your queue is overflowing use either netstat or nstat
Reference: https://perfchron.com/2015/12/26/investigating-linux-network-issues-with-netstat-and-nstat/
To monitor your queue sizes, use the ss command and look for SYN-RECV sockets.
Reference: https://blog.cloudflare.com/syn-packet-handling-in-the-wild/