A connection timeout is not always a network fault. If an application does not accept completed connections quickly enough, the listening queue can fill and clients experience delays or failed connects. A larger backlog may absorb a short burst, but it does not increase application throughput. Diagnose the listener and kernel counters before changing limits.
1. Separate SYN and accept queues
The SYN queue concerns handshakes not yet completed; the accept queue holds connections ready for the application. net.core.somaxconn caps the backlog requested by listen rather than independently configuring every queue. tcp_max_syn_backlog concerns remembered SYN requests. Check the running kernel and application settings: old tuning guides may describe different defaults or behavior.
uname -r
sysctl net.core.somaxconn net.ipv4.tcp_max_syn_backlog
ss -lnt '( sport = :443 )'
ss -nt state syn-recv '( sport = :443 )'
2. Inspect the right listener and namespace
For a TCP LISTEN socket, Recv-Q reports queued ready connections and Send-Q shows the listener backlog; those columns mean something different on established sockets. One quiet snapshot can miss an earlier burst. Inspect the service’s own network namespace when it runs in a container. Evaluate multiple listeners and reuseport sockets individually rather than treating one row as the whole service.
3. Correlate counter growth with the incident
Read ListenOverflows and ListenDrops at two recorded times and compare their increases with connection bursts and client errors. These counters are generally namespace-wide, not per-port, so an old nonzero total does not identify the current service. Combine them with listener state, application logs and connection-rate monitoring. ListenDrops can grow for reasons other than a full accept queue.
date -Is
nstat -az TcpExtListenOverflows TcpExtListenDrops
# Repeat during the affected period; compare absolute counters.
4. Find why acceptance is slow
CPU saturation, a blocked event loop, insufficient workers, file descriptor limits or memory pressure can slow acceptance. A larger queue under sustained overload merely increases waiting time. Review application capacity and behavior first. Do not enable tcp_abort_on_overflow as a quick fix: it can reset client connections and make failures more visible rather than solving the bottleneck.
5. Make a bounded change and validate
Only after confirming a short burst and spare processing capacity should you align the application backlog and kernel ceiling. Record the old value: 4096 is an example, not universal advice, and may already be the default. A sysctl change does not necessarily rebuild an existing listener; check the service’s reload behavior. Test controlled load before persisting to sysctl.d. Accept only lower overflow growth and fewer timeouts without unacceptable queue latency; restore prior values on regression.
# Example only, after recording and reviewing the current value:
sudo sysctl -w net.core.somaxconn=4096
ss -lnt '( sport = :443 )'
nstat -az TcpExtListenOverflows TcpExtListenDrops
