Performance Tuning & Kernel Parameters (Sysctl)
Stop your TCP connections from hanging on heavy traffic
đź§© The Challenge
Dealing with a production app that starts dropping connections once the backlog fills up during a minor spike is the absolute worst. I spent a whole afternoon debugging a ghost connection issue before realizing the OS was just punting on new handshakes.
đź’ˇ The Fix
Increase the listen backlog limits so your server can actually hold onto those pending connection requests instead of just dropping them into the void. It’s the easiest way to give your app some breathing room when things get hectic.
sysctl -w net.core.somaxconn=65535
sysctl -w net.ipv4.tcp_max_syn_backlog=65535
⚙️ Why It Works
These parameters bump the size of the kernel-level queues that buffer incoming connections before your application gets around to accepting them. You’re basically widening the front door so the building doesn’t crowd up when everyone arrives at once.
🚀 Pro-Tip: Check your app code too; if the backlog in your software config is still set to the default 128, the kernel settings won’t help you much.
Linux Tips & Tricks | © ngelinux.com | 11/2/2026
