Stop your server from dropping traffic under heavy connection spikes
Performance Tuning & Kernel Parameters (Sysctl)
Stop your server from dropping traffic under heavy connection spikes
🧩 The Challenge
Dealing with a sudden influx of connections that causes your server to start dropping packets is enough to make anyone pull their hair out. I spent three hours tracking down why my web app was randomly resetting connections during high-traffic bursts, only to realize the backlog was just way too small for the actual load.
💡 The Fix
Bumping up the maximum number of connections waiting in the accept queue saves you from dropped traffic. It’s a simple sysctl tweak that acts like an emergency shock absorber for your network stack.
sysctl -w net.core.somaxconn=65535
sysctl -w net.ipv4.tcp_max_syn_backlog=65535
⚙️ Why It Works
These settings tell the kernel to stop being so stingy with memory when holding pending connections, allowing the application layer enough time to actually process them before the buffer overflows. Keeping these values high ensures that your listen queue can handle those momentary spikes that usually crash services.
🚀 Pro-Tip: Don’t forget to make it permanent in /etc/sysctl.conf unless you want to do this again after the next reboot.
Linux Tips & Tricks | © ngelinux.com | 9/24/2026
