linux centos system params operation - yaokun123/php-wiki GitHub Wiki

Centos系统参数优化

一、内核相关参数(/etc/sysctl.conf)

1、net.core.somaxconn=65535
2、net.core.netdev_max_backlog=65535
3、net.ipv4.tcp_max_syn_backlog=65535
4、net.ipv4.tcp_fin_timeout=10
5、net.ipv4.tcp_tw_reuse=1
6、net.ipv4.tcp_tw_recycle=1

7、net.core.wmem_default=87380
8、net.core.wmem_max=16777216
9、net.core.rmem_default=97380
10、net.core.rmem_max=16777216

11、net.ipv4.tcp_keepalive_time=120
12、net.ipv4.tcp_keepalive_intvl=30
13、net.ipv4.tcp_keepalive_probes=3

kernel.shmmax=4294967295
vm.swappiness=0

二、增加资源限制(/etc/security/limit.conf)

* soft nofile 65535
* hard nofile 65535

*:表示对所有用户有效
soft:指的是当前系统生效的设置
hard:表明系统中所能设定的最大值
nofile:表示所限制的资源是打开文件的最大数目
65535:就是限制的数量

注意:这个文件的修改需要重启系统才可以生效。

三、磁盘调度策略(/sys/block/devname/queue/scheduler)

cat /sys/block/sda/queue/scheduler
noop anticipatory deadline [cfq]

四、文件系统

EXT3/EXT4系统的挂载参数(/etc/fstab)

data=writeback|ordered|journal|noatime|nodiratime