Performance Tuning & Kernel Parameters (Sysctl)
Stop your server from dropping connections when things get noisy
đź§© The Challenge
Dealing with a massive spike in incoming connections usually means your server starts hitting connection limits before it actually runs out of CPU. I’ve spent whole nights fighting mysterious connection resets that turned out to be the backlog queue overflowing.
đź’ˇ The Fix
You need to bump up the TCP syncookies and the backlog limit so the kernel doesn’t just toss away connection requests when it’s busy. It’s a simple way to keep your service responsive during a traffic burst.
sysctl -w net.ipv4.tcp_syncookies=1
sysctl -w net.ipv4.tcp_max_syn_backlog=4096
sysctl -w net.core.somaxconn=1024
⚙️ Why It Works
Setting syncookies acts as a buffer against syn-flood attacks, while the backlog and somaxconn values tell the kernel to keep a much larger queue of waiting connections ready for your application to pick up.
🚀 Pro-Tip: Always make these permanent in /etc/sysctl.d/99-tuning.conf or your hard work disappears on the next reboot.
Linux Tips & Tricks | © ngelinux.com | 11/2/2026
