Stop your TCP stack from dropping connections under load
Performance Tuning & Kernel Parameters (Sysctl)
Stop your TCP stack from dropping connections under load
🧩 The Challenge
You finally have a flash sale or a spike in traffic, but your server starts dropping incoming connections like a lead balloon. I’ve spent whole afternoons staring at netstat output wondering why the backlog queue is overflowing while the CPU is barely even sweating.
💡 The Fix
Increase the size of the listen backlog and the connection tracking table to give your server more breathing room during traffic spikes. You’ll stop those “connection refused” errors that keep your dev team awake at night.
sysctl -w net.core.somaxconn=65535
sysctl -w net.ipv4.tcp_max_syn_backlog=65535
⚙️ Why It Works
By cranking these values, you’re telling the kernel to hold onto more pending connections before it starts aggressively rejecting them. Most distros ship with laughably low defaults that just aren’t meant for modern traffic volumes.
🚀 Pro-Tip: Don’t forget to add these to /etc/sysctl.d/99-tuning.conf so they actually stick after you reboot.
Linux Tips & Tricks | © ngelinux.com | 9/9/2026
