Stop your server from forgetting connections under heavy load
Performance Tuning & Kernel Parameters (Sysctl)
Stop your server from forgetting connections under heavy load
🧩 The Challenge
Dealing with a web server that suddenly stops responding while the CPU is barely idling? You’ve likely hit the ephemeral port limit, and it feels like the kernel is just ghosting your traffic.
💡 The Fix
Increase your local port range to give the networking stack enough breathing room to cycle through connections. It stops the “cannot assign requested address” errors that haunt high-traffic services.
sysctl -w net.ipv4.ip_local_port_range="1024 65535"
⚙️ Why It Works
By default, many distros cap your range at around 32k ports, which is honestly pathetic for a modern high-concurrency app. Expanding this lets the OS track way more concurrent sockets simultaneously.
🚀 Pro-Tip: Verify the change sticks after a reboot by adding it to /etc/sysctl.conf instead of just setting it live.
Linux Tips & Tricks | © ngelinux.com | 9/16/2026
