Stop your Linux box from throwing away incoming connections before your app sees them
Performance Tuning & Kernel Parameters (Sysctl)
Stop your Linux box from throwing away incoming connections before your app sees them
🧩 The Challenge
Dealing with a massive traffic spike is bad enough, but finding out the kernel is dropping connections because your backlog queue is too small is a special kind of nightmare. I spent three hours chasing ghosts in application logs once before realizing the packets weren’t even hitting the daemon.
💡 The Fix
You need to bump up the listen backlog limit in sysctl so the kernel can actually hold those waiting connections long enough for your app to accept them. It saves you from those mysterious connection refused errors when things get busy.
sysctl -w net.core.somaxconn=4096
⚙️ Why It Works
That default limit of 128 is a relic from the nineties and absolutely won’t cut it for any modern web service under load. Bumping this number lets the kernel queue up thousands of pending handshakes instead of instantly sending a reset packet to your users.
🚀 Pro-Tip: Always update /etc/sysctl.conf too, or your changes will evaporate the second your server reboots.
Linux Tips & Tricks | © ngelinux.com | 7/30/2026
