修改下面的这些参数,如果没有的话。直接复制进去就可以了
vim /etc/sysctl.conf
参数修改
vm.swappiness =
net.ipv4.neigh.default.gc_stale_time=
net.ipv4.conf.all.rp_filter=
net.ipv4.conf.default.rp_filter=
net.ipv4.conf.default.arp_announce =
net.ipv4.conf.all.arp_announce=
net.ipv4.tcp_max_tw_buckets = #timewait的数量,默认是180000。
net.ipv4.tcp_syncookies = #开启SYN Cookies,当出现SYN等待队列溢出时,启用cookies来处理。
net.ipv4.tcp_max_syn_backlog = #记录的那些尚未收到客户端确认信息的连接请求的最大值。对于有128M内存的系统而言,缺省值是1024,小内存的系统则是128。
net.ipv4.tcp_synack_retries = #为了打开对端的连接,内核需要发送一个SYN并附带一个回应前面一个SYN的ACK。也就是所谓三次握手中的第二次握手。这个设置决定了内核放弃连接之前发送SYN+ACK包的数量。
net.ipv4.conf.lo.arp_announce=
fs.file-max= #文件描述符,与ulimit -n一样大即可 建议大家修改一下 ulimit 的 open files 数量 /etc/sysctl.conf 常见优化参数如下(记得修改后要:sysctl –p):
记录的配置
# Kernel sysctl configuration file for Red Hat Linux #
# For binary values, is disabled, is enabled. See sysctl() and
# sysctl.conf() for more details.
# Controls IP packet forwarding net.ipv4.ip_forward =
# Controls source route verification
# Do not accept source routing net.ipv4.conf.default.accept_source_route =
# Controls the System Request debugging functionality of the kernel kernel.sysrq =
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications. kernel.core_uses_pid =
# Controls the use of TCP syncookies
# Disable netfilter on bridges. net.bridge.bridge-nf-call-ip6tables = net.bridge.bridge-nf-call-iptables = net.bridge.bridge-nf-call-arptables =
# Controls the default maxmimum size of a mesage queue kernel.msgmnb =
# Controls the maximum size of a message, in bytes kernel.msgmax =
# Controls the maximum shared segment size, in bytes kernel.shmmax =
# Controls the maximum number of shared memory segments, in pages kernel.shmall = vm.swappiness = net.ipv4.neigh.default.gc_stale_time= net.ipv4.conf.all.rp_filter= net.ipv4.conf.default.rp_filter= net.ipv4.conf.default.arp_announce = net.ipv4.conf.all.arp_announce= net.ipv4.tcp_max_tw_buckets =
#timewait的数量,默认是180000。 net.ipv4.tcp_syncookies =
#开启SYN Cookies,当出现SYN等待队列溢出时,启用cookies来处理。
net.ipv4.tcp_max_syn_backlog =
#记录的那些尚未收到客户端确认信息的连接请求的最大值。对于有128M内存的系统而言,缺省值是1024,小内存的系统则是128。 net.ipv4.tcp_synack_retries =
#为了打开对端的连接,内核需要发送一个SYN并附带一个回应前面一个SYN的ACK。也就是所谓三次握手中的第二次握手。这个设置决定了内核放弃连接之前发送SYN+ACK包的数量。 net.ipv4.conf.lo.arp_announce= fs.file-max=
#文件描述符,与ulimit -u 一样大即可