一.内核(/etc/sysctl.conf)
1.加大端口号范围
net.ipv4.ip_local_port_range = 10240 65000
2.tcp/ip重用及超时限制
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_timestamps = 1
3.队列允许连接数
net.ipv4.tcp_max_syn_backlog = 20480
4.使其生效
sysctl -p
如果出现
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
解决方法如下:
modprobe bridge
lsmod|grep bridge
二.文件数限制修改(系统默认为1024)
1.查看系统打开文件数限制
#ulimit -a
2.修改打开文件数限制
#vi /etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
三.硬盘调优
1.查看分区类型
#df -Th
2.优化ext3分区类型,关闭atime写入
a,vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/data /data ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda3 swap swap defaults 0 0
b.将defaults修改为defaults,noatime
c,重新挂载或重启
重新挂载
mount -o remount /data