Operations 7 min read

9 Essential Linux Server Optimization Tips for Faster, Safer Operations

This article presents nine practical Linux server optimization techniques—including time synchronization, SYN cookie activation, Squid and Nginx tuning, increasing file descriptor limits, disabling unnecessary services, turning off IPv6, enabling RHEL NIC ONBOOT, and understanding memory management—to achieve precise, stable, efficient, and secure server performance.

Open Source Linux
Open Source Linux
Open Source Linux
9 Essential Linux Server Optimization Tips for Faster, Safer Operations

1. Time Synchronization

Accurate time is critical; for a mail server using Dovecot, time drift caused service stops. Edit /etc/crontab and add a daily NTP sync:

14 04 * * * root /usr/sbin/ntpdate ntp.api.bz > /dev/null 2>&1

2. Enable SYN Cookie Protection

Activate kernel SYN cookies: echo "1" > /proc/sys/net/ipv4/tcp_syncookies Apply immediately:

/sbin/sysctl -p

3. Fix Slow Squid Server

When Squid slows down, run:

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

Adjust kernel parameters in /etc/sysctl.conf:

net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000

Apply:

/sbin/sysctl -p

4. Nginx Server Settings

For Nginx load balancers or Nginx+PHP5 web servers, enable:

net.ipv4.tcp_tw_reuse = 1   # reuse TIME-WAIT sockets
net.ipv4.tcp_tw_recycle = 1 # fast recycle TIME-WAIT sockets

Apply:

/sbin/sysctl -p

5. Increase Max Open Files

Modify /etc/security/limits.conf and add:

* soft nofile 60000
* hard nofile 65535

Note: ulimit -SHn or editing /etc/rc.d/rc.local cannot change the system limit.

6. Run Only Required Services

Enable essential services only, e.g.:

crond irqbalance microcode_ctl network random sshd syslog

Check services at runlevel 5:

chkconfig --list | awk '{print $1 " " $7}' | grep 5:on

Stop and disable unnecessary services such as cups:

service cups stop
chkconfig cups off

7. Disable IPv6

Edit /etc/modprobe.conf and append:

alias net-pf-10 off
alias ipv6 off
echo "IPV6INIT=no" >> /etc/sysconfig/network-scripts/ifcfg-eth0

8. Enable RHEL NIC ONBOOT

For RHEL, edit /etc/sysconfig/network-scripts/ifcfg-eth0 (or eth1) and set: ONBOOT=YES Then restart network:

service network restart

9. Linux Memory Management

Linux uses available memory aggressively; it employs buffer cache and page cache to speed up disk I/O. The default behavior is generally optimal, so manual tuning is rarely needed.

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.

Linuxsysctlserver optimization
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

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.