Performance Tuning & Kernel Parameters (Sysctl)
Stop your server from nuking connections during a traffic spike
đź§© The Challenge
You’re staring at your monitoring dashboard and see your web server dropping connections like crazy during a minor traffic bump. You check the load, everything looks fine, but the kernel is silently discarding SYN packets because the connection queue is just too small.
đź’ˇ The Fix
Bumping up your backlog limit tells the kernel to hold onto those connection attempts instead of just binning them at the door. It’s a five-second change that saves your app from falling over when things get busy.
sysctl -w net.core.somaxconn=4096
sysctl -w net.ipv4.tcp_max_syn_backlog=4096
⚙️ Why It Works
By increasing these values, you’re expanding the buffer space for incoming connections that haven’t been fully accepted by the application yet. It gives your processes a bit of breathing room to catch up when requests start piling in faster than the event loop can handle them.
🚀 Pro-Tip: Don’t forget to make it permanent in /etc/sysctl.conf unless you want to lose your changes after the next reboot.
Linux Tips & Tricks | © ngelinux.com | 11/27/2026
