Linux内核高性能优化-内核优化启动--\#当内核出现panic时,会在1秒后自动重启。kernel.panic=1\#允许更多的PID(减少滚动问题);maybreaksomeprograms32768kernel.pid_max=32768\#内核允许的最大共享内存段的大小(字节)kernel.shmmax=4294967296\#在任何给定时刻,可以使用的共享内存总量system(pages)kernel.shmall=1073741824\#设置程序core时生成的文件名格式kernel.core_pattern=core_%e\#发生oom时会自动转换为panicvm.panic_on_oom=1\#表示最小LinuxVM保留的空闲内存量(Kbytes)vm.min_free_kbytes=1048576\#如果该值大于100,会导致内核倾向于回收目录和inodecachevm.vfs_cache_pressure=250\#表示程度systemexchangebehavior,值越大(0-100),越有可能发生diskswapvm.swappiness=20\#只使用10%作为系统cachevm.dirty_ratio=10\#增加系统文件描述符限制2^20-1fs.file-max=1048575\#网络层优化\#listen()的默认参数,最大挂起请求数,默认为128net.core.somaxconn=1024\#增加Linux自动调整TCPbufferlimitnet.core.wmem\_default=8388608net.core.rmem\_default=8388608net。core.rmem\_max=16777216net.core.wmem\_max=16777216\#传入数据包的最大设备队列。默认为300并记录欺骗、源路由和重定向数据包net.ipv4.conf.all.log\_martians=1net.ipv4.conf.default.log\_martians=1\#处理被动路由包net.ipv4.conf.all.accept\_source\_route=0net.ipv4.conf.default.accept\_source\_route=0\#启用反向路径过滤net.ipv4.conf.all.rp\_filter=1net.ipv4.conf.default.rp\_filter=1\#确保没有人可以修改路由表net.ipv4.conf.all。accept\_redirects=0net.ipv4.conf.default.accept\_redirects=0net.ipv4.conf.all.secure\_redirects=0net.ipv4.conf.default.secure\_redirects=0\#增加系统IP端口限制net.ipv4.ip_local_port_range=900065533\#TTLnet.ipv4.ip_default_ttl=64\#增加TCP最大缓冲区大小net.ipv4.tcp\_rmem=4096873808388608net.ipv4.tcp\_wmem=4096327688388608\#Tcpnet.ipv4.tcp_window_scaling=1\#输入SYN数据包的最大请求队列。Default1024net.ipv4.tcp_max_syn_backlog=8192\#开启TIME-WAITsocket复用功能,对于连接数较多的web服务器非常有效net.ipv4.tcp\_tw\_recycle=1net.ipv4.tcp\_tw\_reuse=0\#表示是否启用比超时重传更精确的RTT计算(参见RFC1323);为了实现更好的性能,应该开启这个选项net.ipv4.tcp_timestamps=0\#表示本地TCPSYN连接超时时的重传次数net.ipv4.tcp\_syn\_retries=2net.ipv4.tcp\_synack\_retries=2\#减少FIN-WAIT-2连接状态的时间,让系统可以处理更多的连接。net.ipv4.tcp_fin_timeout=10\#减少TCPKeepAlive连接检测的时间,让系统可以处理更多的连接。\#如果某个TCP连接空闲300秒,内核会发起探测。如果2次探测不成功(每次2秒),内核就会彻底放弃,认为连接失败。net.ipv4.tcp\_keepalive\_time=300net.ipv4.tcp\_keepalive\_probes=2net.ipv4.tcp\_keepalive\_intvl=2\#系统可以处理不属于任何的TCP套接字的最大数量processnet.ipv4.tcp_max_orphans=262144\#系统同时保持TIME_WAITsockets的最大数量。如果超过这个数字,TIME\_WAIT套接字将被立即清除并打印一条警告消息。net.ipv4.tcp_max_tw_buckets=20000\#arp\_table缓存限制优化net.ipv4.neigh.default.gc\_thresh1=128net.ipv4.neigh.default.gc\_thresh2=512net.ipv4.neigh.default.gc\_thresh3=4096——内核优化结束————更多linux内核参数解释请看:http://yangrong.blog.51cto.co...
