Stop your server from dropping connections when the backlog overflows

Performance Tuning & Kernel Parameters (Sysctl)

Stop your server from dropping connections when the backlog overflows

🧩 The Challenge

Dealing with a web server that just stops accepting connections under load is pure misery. You watch the logs, everything looks fine, but users are getting connection resets because the kernel queue is full.

💡 The Fix

Bumping up the maximum number of pending connections allows the kernel to buffer more incoming handshakes instead of just tossing them into the void. It’s an easy win that keeps your service responsive during spikes.

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

⚙️ Why It Works

These settings tell the kernel to hold a much larger buffer for incoming connection requests waiting for the application to accept them. Most systems ship with these set way too low for modern traffic levels.

🚀 Pro-Tip: Check your app’s internal listen backlog too, because the kernel can only help as much as your code is configured to allow.

Linux Tips & Tricks | © ngelinux.com | 10/20/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted