linux sysctl.conf - artinfo1982/demos GitHub Wiki

fs.nr_open = 5000000
fs.file-max = 5000000
net.ipv4.ip_local_port_range = 1025 65535
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
#允许网卡队列缓存的最大消息数
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_mem = 786432 2097152 3145728
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
net.ipv4.ip_forward = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 3
net.ipv4.tcp_keepalive_time = 600
#系统允许TIME_WAIT的最大数量,超过这个值,socket会被立即关闭,默认180000
net.ipv4.tcp_max_tw_buckets = 1000
net.ipv4.tcp_max_syn_backlog = 131072
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.tcp_window_scaling = 1
net.unix.max_dgram_qlen = 1024
net.ipv4.icmp_echo_ignore_all = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
vm.drop_caches = 3
vm.swappiness = 10
vm.dirty_ratio = 80
vm.dirty_background_ratio = 5
vm.dirty_expire_centisecs = 12000

可以在root的crontab中添加:

*/10 * * * * echo 3 > /proc/sys/vm/drop_caches