首页 > 代码库 > 优化脚本

优化脚本

第一步

vim /etc/sysctl.conf
net.ipv4.tcp_keepalive_time =1800
net.ipv4.tcp_keepalive_probes =5
net.ipv4.tcp_keepalive_intvl =15
net.core.rmem_max =167772160
net.core.wmem_max =167772160
net.ipv4.tcp_rmem =4096 87380 167772160
net.ipv4.tcp_wmem =4096 65536 167772160
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 0
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_no_metrics_save =1
net.core.somaxconn = 2621440
#net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_orphans = 2621440
net.ipv4.tcp_max_syn_backlog = 2621440
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.ip_conntrack_max = 6553600
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_max_tw_buckets = 20000
net.ipv4.ip_local_port_range = 1024  65535
net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 120
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait = 120
net.ipv4.neigh.default.gc_thresh1 = 10240
net.ipv4.neigh.default.gc_thresh2 = 40960
net.ipv4.neigh.default.gc_thresh3 = 81920
vm.dirty_ratio = 10


第二步

ulimit

/sbin/sysctl -p



第三步


ulimit -n 65536


第四步


vim /etc/security/limits.conf
增加
*                soft    nofile          65536
*                hard    nofile          65536
















本文出自 “绿茶布丁” 博客,请务必保留此出处http://pudding.blog.51cto.com/8909132/1411493