Operations 10 min read

25 Proven Linux Performance Tuning Tricks to Boost System Speed

Learn 25 practical Linux performance tuning techniques—from adjusting kernel parameters like swappiness and ulimit to optimizing I/O schedulers, network buffers, and enabling HugePages—each with clear commands and step‑by‑step instructions to help you maximize system responsiveness and throughput.

Java Architecture Stack
Java Architecture Stack
Java Architecture Stack
25 Proven Linux Performance Tuning Tricks to Boost System Speed

Linux system performance tuning is a multi‑layered process that involves kernel parameter tweaks, hardware configuration, and application‑level adjustments. The following 25 tips provide concrete commands and actions to improve overall system efficiency.

1. Adjust swappiness Parameter

Tip: Reduce reliance on swap to improve memory usage efficiency.

Action: Set a lower value (e.g., 10) in /proc/sys/vm/swappiness so the system prefers physical memory.

sysctl vm.swappiness=10

2. Monitor System Resources with top and htop

Tip: Regularly use top or the more visual htop to view CPU, memory, and load, identifying performance bottlenecks.

3. Adjust ulimit Settings

Tip: Increase the limit of open file descriptors for processes to avoid resource exhaustion under high load.

Action: Edit /etc/security/limits.conf and add:

* hard nofile 65535
* soft nofile 65535

4. Optimize I/O Scheduler

Tip: Choose an appropriate I/O scheduler for the workload (e.g., noop for SSD, deadline for low‑latency apps).

Action: Change the scheduler:

echo noop > /sys/block/sda/queue/scheduler

5. Use vmstat to Monitor System Performance

Tip: View detailed CPU, memory, and I/O statistics to understand load and adjust promptly.

vmstat 1

6. Adjust dirty_ratio and dirty_background_ratio

Tip: Optimize write‑back cache flushing frequency to reduce disk I/O pressure.

sysctl vm.dirty_ratio=15
sysctl vm.dirty_background_ratio=5

7. Enable Huge Pages

Tip: For memory‑intensive applications (e.g., databases), enable huge pages to lower allocation overhead.

Action: Add to /etc/sysctl.conf:

vm.nr_hugepages=256

8. Adjust Kernel Parameter net.core.somaxconn

Tip: Increase the server's connection queue length to avoid refusals under high concurrency.

sysctl -w net.core.somaxconn=1024

9. Optimize Network Buffers

Tip: Increase network buffer sizes to prevent packet loss under heavy load.

sysctl -w net.core.rmem_max=16777216
sysctl -w net.core.wmem_max=16777216

10. Disable Unnecessary Services

Tip: Turn off services you do not need to reduce resource consumption.

Action: Use systemctl disable or chkconfig to disable them.

11. Monitor Disk Performance with iostat

Tip: Regularly check disk I/O performance to detect bottlenecks.

iostat -x 1

12. Adjust tcp_tw_reuse and tcp_tw_recycle

Tip: Reduce the number of TIME_WAIT sockets for short‑lived connections.

sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_tw_recycle=1

13. Use tuned for Automatic System Optimization

Tip: Install tuned and select a profile that automatically adjusts kernel parameters for the system role.

yum install tuned
tuned-adm profile throughput-performance

14. Enable Asynchronous I/O (AIO)

Tip: For high‑performance I/O workloads (e.g., databases), enable AIO to increase parallelism.

15. Adjust Filesystem Mount Options

Tip: Use the noatime option to avoid updating access times on each read, reducing disk I/O.

Action: Edit /etc/fstab and add noatime:

/dev/sda1 / ext4 defaults,noatime 0 0

16. Accelerate DNS Resolution with nscd

Tip: Cache DNS queries to speed up frequent network requests.

Action: Install and start nscd:

yum install nscd
systemctl start nscd

17. Disable Unnecessary Kernel Modules

Tip: Unload modules you do not need to free memory and CPU cycles.

Action: List loaded modules with lsmod and remove them using modprobe -r.

18. Analyze Performance with perf

Tip: Use perf to identify application bottlenecks for targeted tuning.

perf top

19. Optimize Process Scheduling

Tip: Assign higher scheduling priority to critical tasks using chrt.

chrt -f 99 <process-id>

20. Adjust TCP Window Size

Tip: Increase the TCP window to improve throughput on high‑latency networks.

sysctl -w net.ipv4.tcp_window_scaling=1
sysctl -w net.core.rmem_default=262144
sysctl -w net.core.wmem_default=262144

21. Enable Transparent Huge Pages (THP)

Tip: Activate THP to boost performance for applications requiring large memory blocks.

Action: Set /sys/kernel/mm/transparent_hugepage/enabled to always.

echo always > /sys/kernel/mm/transparent_hugepage/enabled

22. Adjust tcp_fin_timeout

Tip: Reduce the wait time for closed TCP connections to free resources faster.

sysctl -w net.ipv4.tcp_fin_timeout=15

23. Use SSDs for Faster Read/Write

Tip: Replace HDDs with SSDs for high‑I/O workloads to dramatically improve performance.

24. Enable NUMA (Non‑Uniform Memory Access) Optimization

Tip: On multi‑core systems, enable NUMA to exploit memory locality.

Action: Use numactl to interleave memory across nodes:

numactl --interleave=all <application>

25. Speed Up Boot with systemd-analyze

Tip: Analyze boot time and disable services that cause delays. systemd-analyze blame Applying the relevant tips based on your workload can significantly improve overall Linux system performance and responsiveness.

Monitoringsystem optimizationPerformance TuningLinuxI/O schedulerKernel ParametersNetwork Tuning
Java Architecture Stack
Written by

Java Architecture Stack

Dedicated to original, practical tech insights—from skill advancement to architecture, front‑end to back‑end, the full‑stack path, with Wei Ge guiding you.

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.