Stop your high-load servers from choking on TCP backlog

Performance Tuning & Kernel Parameters (Sysctl)

Stop your high-load servers from choking on TCP backlog

🧩 The Challenge

You know that feeling when your web server is perfectly healthy but half the users are getting connection resets during a traffic spike? I spent two days chasing phantom network issues before realizing the kernel was just dropping connection requests because the queue was too small.

💡 The Fix

Bumping up the maximum allowed backlog for TCP connections lets your server hold onto more pending requests while your app processes them. It’s an easy win for any high-traffic machine.

sysctl -w net.core.somaxconn=4096
sysctl -w net.ipv4.tcp_max_syn_backlog=4096

⚙️ Why It Works

These settings tell the kernel to stop being so aggressive about tossing out new connection attempts when the accept queue hits its limit. By expanding those buffers, you give your application enough breathing room to handle bursts without nuking users mid-handshake.

🚀 Pro-Tip: Check your application code too, because some default listeners hardcode a backlog limit that will ignore your sysctl changes until you bump the app config as well.

Linux Tips & Tricks | © ngelinux.com | 9/4/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted