proc下个文件
来源:互联网 发布:生成木马软件下载 编辑:程序博客网 时间:2024/04/28 13:02
/proc/sys/kernel/优化
一、前言
本文档针对OOP8生产环境,具体优化策略需要根据实际情况进行调整;本文档将在以下几个方面来阐述如何针对RedHat Enterprise Linux进行性能优化。
1) Linux Proc文件系统,通过对Proc文件系统进行调整,达到性能优化的目的。
2) Linux性能诊断工具,介绍如何使用Linux自带的诊断工具进行性能诊断。
xinetd
vsftpd
crond
local
修改完后,重新启动系统。
如此,系统将仅仅启动选中的这些守护进程。
2) 减少终端连接数
系统默认启动6个终端,而实际上只需启动3个即可;以root身份登录系统,运行vi /etc/inittab,修改成如下:
# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6
如上所述,注释掉4、5、6终端。
3) 待续。。。
7.2 网络优化
1) 优化系统套接字缓冲区
net.core.rmem_max=16777216
net.core.wmem_max=16777216
2) 优化TCP接收/发送缓冲区
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
3) 优化网络设备接收队列
net.core.netdev_max_backlog=3000
4) 关闭路由相关功能
net.ipv4.conf.lo.accept_source_route=0
net.ipv4.conf.all.accept_source_route=0
net.ipv4.conf.eth0.accept_source_route=0
net.ipv4.conf.default.accept_source_route=0
net.ipv4.conf.lo.accept_redirects=0
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.eth0.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.lo.secure_redirects=0
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.eth0.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0
net.ipv4.conf.lo.send_redirects=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.eth0.send_redirects=0
net.ipv4.conf.default.send_redirects=0
5) 优化TCP协议栈
打开TCP SYN cookie选项,有助于保护服务器免受SyncFlood攻击。
net.ipv4.tcp_syncookies=1
打开TIME-WAIT套接字重用功能,对于存在大量连接的Web服务器非常有效。
net.ipv4.tcp_tw_recyle=1
net.ipv4.tcp_tw_reuse=1
减少处于FIN-WAIT-2连接状态的时间,使系统可以处理更多的连接。
net.ipv4.tcp_fin_timeout=30
减少TCP KeepAlive连接侦测的时间,使系统可以处理更多的连接。
net.ipv4.tcp_keepalive_time=1800
增加TCP SYN队列长度,使系统可以处理更多的并发连接。
net.ipv4.tcp_max_syn_backlog=8192