Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Optimization of kernel parameters of Linux server

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Linux kernel parameter tuning is mainly achieved by modifying the parameters of the / proc pseudo file system and / etc/sysctl.conf configuration file.

The directory structure of / proc is as follows:

/ proc/driver drive-related information

/ proc/fs file system parameters

/ proc/net network information

/ proc/pid information for each process

/ proc/sys kernel parameters

/ proc/scsi information related to scsi

/ proc/meminfo memory related information

/ proc/cpuinfo CPU related information

/ proc/loadavg system load

Modules or drivers loaded by / proc/modules system

/ proc/partitions system partition information

/ proc/version kernel version information

/ proc/stat CPU utilization, disk, memory page

/ proc/devices list of available devices

/ proc/sys/kernel general kernel parameters

/ proc/sys/vm memory management parameters

/ proc/sys/dev device-related information

/ proc/sys/net network information

The files in a process directory are described as follows:

File descriptor opened by the / proc/pid/fd process

Executable file for / proc/pid/exe process

/ proc/pid/cmdline some parameters of the current process running

/ proc/pid/environ the environment variable of the current process

/ proc/pid/status the basic status of the current process

Vim / etc/sysctl.conf

Net.ipv4.tcp_syncookies = 1 # enable SYN Cookies. Can prevent a small amount of SYN***.

Net.ipv4.ip_local_port_range = 10000 65535 # set the port range for outbound connections

Net.ipv4.route.gc_timeout = 100 # Route cache refresh frequency

Net.core.netdev_max_backlog = 16384 # allow queuing for more messages

Net.core.somaxconn = 16384 # specify a larger accept queue backlog

Net.ipv4.tcp_max_syn_backlog = 16384 # increase the length of the SYN queue

Net.ipv4.tcp_synack_retries = 1 # number of times to resend the response

Net.ipv4.tcp_retries2 = 5 # number of times to resend data to the remote host

Net.ipv4.tcp_keepalive_time = 1200 # how often the kernel sends Keepalive messages to remote hosts

Net.ipv4.tcp_keepalive_intvl = 30 # interval at which the kernel sends probe messages to remote hosts

System optimization script:

#! / bin/bash

Yum-y groupinstall "Development tools"

Cd / usr/local/src

Wget https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Rpm-ivh epel-release-6-8.noarch.rpm

Sed-I's etc/selinux/config SelinuxplenforcingAccording to SELINUXAfter

Sed-I 's/start on control-alt-delete/#start on control-alt-delete/' / etc/init/control-alt-delete.conf

Sed-I 's@exec / sbin/shutdown-r now "Control-Alt-Delete pressed" @ # exec / sbin/shutdown-r now "Control-Alt-Delete pressed" @' / etc/init/control-alt-delete.conf

Service iptables stop

Chkconfig iptables off

Ulimit-SHn 65534

Echo "ulimit-SHn 65534" > > / etc/rc.local

Cat > > / etc/sysctl.conf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 223

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report