Stop the kernel from dropping connections when your backlog hits the wall

Performance Tuning & Kernel Parameters (Sysctl)

Stop the kernel from dropping connections when your backlog hits the wall

🧩 The Challenge

Dealing with a production web app where the server just starts hanging and timing out requests despite low CPU usage is enough to drive you to drink. Turns out the kernel was just silently tossing packets because the connection queue was way too small.

💡 The Fix

You need to crank up the maximum number of connections waiting in the accept queue. It keeps the kernel from being overwhelmed during a sudden surge in traffic.

sysctl -w net.core.somaxconn=4096

⚙️ Why It Works

Setting this value higher forces the kernel to hold onto incoming connections longer before saying no. It effectively buys your application enough breathing room to catch up with the request flow.

🚀 Pro-Tip: Don’t forget to update the corresponding listen backlog in your Nginx or Apache config, otherwise, the kernel setting won’t do much good.

Linux Tips & Tricks | © ngelinux.com | 11/28/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted