Performance Tuning & Kernel Parameters (Sysctl)
Stop TCP connection drops when your backlog hits the wall
🧩 The Challenge
Dealing with a web server that just stops accepting new connections during a sudden traffic spike is infuriating. The app isn’t even overloaded, but the kernel is silently tossing incoming SYN packets because the queue is full.
💡 The Fix
Crank up the listen backlog limits so your application can actually keep pace with incoming request volume. It prevents the kernel from acting like a bouncer who refuses to let anyone into the party.
sysctl -w net.core.somaxconn=4096
sysctl -w net.ipv4.tcp_max_syn_backlog=4096
⚙️ Why It Works
These settings tell the kernel to stop being so stingy with connection buffers and hold onto more pending requests before giving up. Keep in mind you also need to update your application code to actually accept that many concurrent connections, otherwise you’re just moving the bottleneck.
🚀 Pro-Tip: Check your listen queue size with ss -lnt to see if your current backlog is actually maxing out before you change anything.
Linux Tips & Tricks | © ngelinux.com | 8/13/2026
