Operations 10 min read

Boost Linux Server Performance: Essential Kernel Parameter Tweaks and Resource Limits

This guide explains how to optimize Linux kernel parameters, increase file descriptor limits, and choose appropriate disk scheduling strategies to improve server performance, with practical examples for network tuning, Nginx configuration, and system resource adjustments.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Boost Linux Server Performance: Essential Kernel Parameter Tweaks and Resource Limits

1. Optimize Kernel Parameters

Modify /etc/sysctl.conf to add parameters. Use sysctl -a to view defaults and sysctl -p to apply changes.

sysctl -a
sysctl -p

Network‑related parameters such as net.core.somaxconn, net.core.netdev_max_backlog, net.ipv4.tcp_max_syn_backlog, net.ipv4.tcp_fin_timeout, net.ipv4.tcp_tw_reuse, and net.ipv4.tcp_tw_recycle can be increased to improve connection handling.

net.core.somaxconn=65535
net.core.netdev_max_backlog=65535
net.ipv4.tcp_max_syn_backlog=65535
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1

Typical tuning values (selected parameters):

fs.file-max: default 1048576 → tuned 9999999 – total file descriptors.

net.core.rmem_max: default 124928 → tuned 8388608 – max TCP receive buffer.

net.core.wmem_max: default 124928 → tuned 8388608 – max TCP send buffer.

net.ipv4.tcp_keepalive_time: default 7200 → tuned 900 seconds.

net.ipv4.tcp_keepalive_intvl: default 75 → tuned 30 seconds.

net.ipv4.tcp_keepalive_probes: default 9 → tuned 3.

Note: larger values are not always better; consider hardware capacity and the impact on other services.

2. Increase Resource Limits

Edit /etc/security/limits.conf to raise the number of open files.

* soft nofile 65535
* hard nofile 65535

Explanation of fields: * applies to all users, soft is the current limit, hard is the maximum, nofile is the max open files, and 65535 is the new limit. Changes require a reboot.

Case study: Nginx experienced “Too many open files” errors during peak traffic because the default open‑file limit was only 1024. After checking ulimit -a and limits.conf, the limits were raised and Nginx configuration added: worker_rlimit_nofile 65535; Verification screenshots show the new limit applied.

3. Disk Scheduling Strategies

Scheduler can be set via /sys/block/<em>devname</em>/queue/scheduler. Common algorithms:

noop : simple FIFO, best for SSDs.

deadline : guarantees service within a deadline, good for databases.

anticipatory : adds a short wait after reads to merge writes, suited for write‑heavy workloads.

cfq : completely fair queueing.

Relevant kernel parameter directories:

/proc/sys/abi/* – binary compatibility.

/proc/sys/fs/* – file limits and quotas.

/proc/sys/kernel/* – PID limits, hot‑plug, shared memory.

/proc/sys/net/* – network tuning.

/proc/sys/vm/* – cache and buffer management.

Images illustrate the Nginx limit check and verification.

Nginx limit verification
Nginx limit verification
Verification result
Verification result
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

KernelLinuxsysctlresource-limitsdisk-scheduler
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.