Performance Tuning & Kernel Parameters (Sysctl)
Stop your TCP stack from drowning in half-open connections
đź§© The Challenge
Dealing with a classic SYN flood or just a messy load balancer that keeps dropping connections? I spent an entire weekend chasing “connection reset by peer” errors only to realize the kernel was giving up way too early.
đź’ˇ The Fix
You need to crank up the queue depth for incoming connections so the box doesn’t reject legit traffic just because it’s slightly busy. It makes your server much more resilient when things get noisy.
sysctl -w net.ipv4.tcp_max_syn_backlog=4096
sysctl -w net.ipv4.tcp_syncookies=1
⚙️ Why It Works
Setting a larger backlog buffer keeps those embryonic connections in the waiting room longer, and enabling syncookies acts as a safety net when the system is under actual duress.
🚀 Pro-Tip: Check your current usage with ss -ant | grep SYN-RECV if you think you’re hitting the wall.
Linux Tips & Tricks | © ngelinux.com | 8/11/2026
