Site icon New Generation Enterprise Linux

Stop your Linux box from dropping TCP connections during spikes

Performance Tuning & Kernel Parameters (Sysctl)

Stop your Linux box from dropping TCP connections during spikes

đź§© The Challenge

You’ve been staring at logs for two hours trying to figure out why your app is randomly dropping connections, only to realize the kernel’s connection queue is too small for the incoming burst. It’s infuriating to watch your application server act like it’s healthy while the OS is quietly trashing SYN packets under load.

đź’ˇ The Fix

Increase the SYN backlog queue size so your server can actually hold those handshakes long enough for your worker threads to pick them up. It’s a simple one-line adjustment that saves you from those nasty connection reset errors.

sysctl -w net.ipv4.tcp_max_syn_backlog=4096

⚙️ Why It Works

By bumping this value, you’re giving the kernel more room to buffer pending TCP connections before they get handed off to your application’s accept() queue. Default settings are usually fine for low traffic, but they crumble instantly when you actually get a decent number of concurrent users.

🚀 Pro-Tip: Make it stick across reboots by adding it to /etc/sysctl.d/99-networking.conf instead of just running it in the shell.

Linux Tips & Tricks | © ngelinux.com | 7/29/2026

0 0 votes
Article Rating
Exit mobile version