π Linux Server Performance
Maximize throughput, concurrency & responsiveness for high-performance workloads
π Overview
This guide focuses on performance tuning of AlmaLinux / RHEL / CentOS servers, optimized for:
- π§ High-memory & high-CPU usage workloads (PHP, Nginx, MySQL, etc.)
- π Optimized network throughput
- βοΈ Better process and file handling
- π» Server-side web applications or APIs
βοΈ 1. tuned: Dynamic Performance Profile
tuned is a system tuning daemon that adapts kernel and system settings automatically based on usage patterns.
π§° Step-by-Step
π¦ Install tuned:
dnf install tuned -y
π Enable and activate the best profile:
systemctl enable --now tuned
tuned-adm profile throughput-performance
π Verify the active profile:
tuned-adm active
π Other profiles:
Use tuned-adm list to view all available profiles like:
balanced(default)latency-performancethroughput-performanceβ (best for web/database servers)network-latency,virtual-guest, etc.
βοΈ 2. Kernel Tweaks (/etc/sysctl.conf)
Tuning the kernel enhances file descriptors, network stack, and TCP behavior.
βοΈ Add the following to /etc/sysctl.conf:
# π’ Max open files
fs.file-max = 2097152
# π§΅ Network queue & backlog
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.ip_local_port_range = 1024 65000
# π‘ TCP tuning
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
# π Window scaling & sync settings
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_syncookies = 1
# π« Disable IPv6 (if unused)
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
β Apply immediately:
sysctl -p
π‘ Tip: BBR congestion control improves latency and throughput significantly on modern kernels.
π 3. Security Limits (/etc/security/limits.conf)
Linux uses ulimit values to define how many files, processes, and memory a user can use.
βοΈ Edit /etc/security/limits.conf:
# π File descriptor and process limits
* soft nofile 1048576
* hard nofile 1048576
* soft nproc 65535
* hard nproc 65535
# π§ Memory locking (disable swapping)
* soft memlock unlimited
* hard memlock unlimited
# π€ Root user overrides
root soft nofile 1048576
root hard nofile 1048576
π Optionally create or edit /etc/security/limits.d/99-custom.conf to make these changes persistent for all sessions.
π§ͺ 4. Verify Limits & Current Settings
Use these commands to verify applied limits:
ulimit -n # π Max open files
ulimit -u # π Max user processes
ulimit -a # π View all current limits
β Expected output (after reboot or re-login):
open files: 1048576max user processes: 65535
π Notes & Best Practices
π Monitor your server regularly:
htop,top,glancesβ CPU/RAM/processesiotopβ Disk I/Oiftop,nloadβ Network usagevmstat,iostat,netstat
π© Donβt over-tune blindly. Every server behaves differently based on its workload.
π‘ Combine these settings with optimized web server configs (e.g., Nginx, PHP-FPM, MariaDB).
ποΈ Reboot your server after applying these changes to fully activate all system-level tweaks.