Site icon New Generation Enterprise Linux

Stop your high-throughput database from tripping over its own TCP sockets

Performance Tuning & Kernel Parameters (Sysctl)

Stop your high-throughput database from tripping over its own TCP sockets

đź§© The Challenge

Dealing with a production database server that suddenly stops accepting new connections during a spike is the kind of headache that makes you want to quit. You’ll stare at the logs, blame the app code, and waste hours hunting for a leak that isn’t actually there.

đź’ˇ The Fix

Bump up your ephemeral port range and tune the TCP keepalive settings so your box doesn’t run out of available sockets under heavy load. It’s the difference between a minor traffic spike and a complete service outage.

sysctl -w net.ipv4.ip_local_port_range="1024 65535"
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_fin_timeout=15

⚙️ Why It Works

By expanding the port range and allowing the kernel to aggressively recycle sockets in the TIME_WAIT state, you stop the OS from sitting on thousands of dead connections while users are waiting to get in. It’s about clearing the junk out of the hallway so the new traffic can actually pass through.

🚀 Pro-Tip: Run sysctl -p after editing /etc/sysctl.conf so your changes actually survive the next reboot.

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

0 0 votes
Article Rating
Exit mobile version