Boost Linux Server Performance: Essential Kernel and File Limit Tweaks
This guide shows how to increase file descriptor limits, adjust TCP settings, and tune kernel parameters such as net.ipv4.tcp_max_syn_backlog on Linux systems, providing step‑by‑step commands for both individual users and all users to improve network performance and handle more concurrent connections.
1. Increase file descriptor limits
For the current shell:
ulimit -n 102400echo "ulimit -n 102400" >> ~/.bashrcFor all users, edit /etc/security/limits.conf:
* soft nofile 102400* hard nofile 102400For the system-wide limit:
cat /proc/sys/fs/file-maxecho 1024000 > /proc/sys/fs/file-max2. Adjust TCP kernel parameters
Edit /etc/sysctl.conf and add:
net.ipv4.ip_local_port_range = 1024 65000net.ipv4.ip_conntrack_max = 10240Apply the changes: sudo sysctl -p 3. Enable TCP TIME_WAIT reuse and recycle
In /etc/sysctl.conf add:
net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1Apply immediately: sudo sysctl -p Understanding net.ipv4.tcp_max_syn_backlog
This kernel parameter controls the size of the SYN‑RECEIVED queue, which defaults to 512 or 1024. When the queue is full, the system stops accepting new TCP connections, helping prevent resource exhaustion. Increase it if you need to handle more simultaneous connection attempts.
Example to view the current value: cat /proc/sys/net/ipv4/tcp_max_syn_backlog On CentOS the default is 1024. To raise it, edit /etc/sysctl.conf and set, for example: net.ipv4.tcp_max_syn_backlog = 2048 Then reload:
sudo sysctl -pSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
