Stop the kernel from dropping packets when your web server gets busy
Performance Tuning & Kernel Parameters (Sysctl)
Stop the kernel from dropping packets when your web server gets busy
🧩 The Challenge
Dealing with a massive burst of traffic only to watch your connection backlog overflow and start dumping packets on the floor is infuriating. I spent a whole afternoon chasing ghosts in my app logs before I realized the kernel was just shrugging and throwing work away because the queue was too small.
💡 The Fix
You need to increase the listen backlog limit so your application has more breathing room to accept incoming connections before they get rejected. It is a quick sysctl change that keeps your server from acting like a bouncer at a club that hit capacity ten minutes ago.
sysctl -w net.core.somaxconn=4096
⚙️ Why It Works
Setting this value forces the kernel to hold more pending connections in the queue, preventing the dreaded connection reset errors during traffic spikes. Default values on most distros are laughably low for anything handling real concurrent users.
🚀 Pro-Tip: Check your application’s source code too; sometimes the app itself has a hardcoded limit that ignores what the kernel allows.
Linux Tips & Tricks | © ngelinux.com | 10/11/2026
