zi663227 发表于 2019-2-16 13:35:40

CentOS6.8系统内核参数优化

  系统内核如下:
  centos6.8
  # uname -a
  Linux localhost.localdomain 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  服务器硬盘配置:
  2颗CPU,单核12核心,开启超线程
  cpu型号:Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz (41500元一台机器)
  共计48线程的逻辑cpu
  内存是96G
  php程序都是短链接
  优化如下:
  # cat /etc/sysctl.conf
  net.ipv4.ip_forward= 0
  kernel.sysrq = 0
  kernel.msgmnb = 65536
  kernel.msgmax = 65536
  kernel.shmmax = 68719476736
  kernel.shmall = 4294967296
  net.ipv4.tcp_syncookies = 1
  net.ipv4.tcp_synack_retries = 2
  net.ipv4.tcp_syn_retries = 2
  vm.overcommit_memory = 1
  net.ipv4.tcp_max_syn_backlog = 1638400
  net.core.somaxconn = 1638400
  net.core.netdev_max_backlog = 20000
  net.ipv4.tcp_max_tw_buckets = 1800000
  net.ipv4.conf.all.send_redirects = 0
  net.ipv4.conf.all.accept_redirects = 0
  net.ipv4.tcp_fin_timeout = 10
  net.ipv4.tcp_keepalive_time = 90
  net.ipv4.ip_local_port_range = 1024 65000
  net.ipv4.tcp_window_scaling = 1
  net.ipv4.icmp_echo_ignore_all = 0
  net.ipv4.icmp_echo_ignore_broadcasts = 1
  net.ipv4.tcp_sack = 0
  net.ipv4.tcp_keepalive_probes = 5
  net.ipv4.tcp_keepalive_intvl = 30
  net.ipv4.tcp_retries2 = 5
  net.ipv4.tcp_max_orphans = 262144
  net.ipv4.tcp_orphan_retries = 3
  net.ipv4.tcp_reordering = 5
  net.ipv4.tcp_retrans_collapse = 0
  net.ipv4.tcp_wmem = 51200 131072 4194304
  net.ipv4.tcp_rmem = 51200 131072 4194304
  net.ipv4.tcp_timestamps = 1
  net.ipv4.tcp_tw_reuse = 1
  net.ipv4.tcp_tw_recycle = 1
  net.netfilter.nf_conntrack_max = 655350
  net.netfilter.nf_conntrack_tcp_timeout_established = 90
  net.netfilter.nf_conntrack_tcp_timeout_close_wait = 30
  net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 60
  net.netfilter.nf_conntrack_tcp_timeout_time_wait = 60
  #
  优化后的并发可以单台服务器可以达到:61525
  # date
  2017年 11月 29日 星期三 22:23:51 CST
  # ss -ant | awk 'NR>1 {++s[$1]} END {for(k in s) print k,s}'
  LAST-ACK 327
  SYN-RECV 255
  ESTAB 61525
  FIN-WAIT-1 615
  CLOSING 6
  FIN-WAIT-2 15732
  TIME-WAIT 12157
  LISTEN 15
  参考地址:
  https://www.cnblogs.com/fczjuever/archive/2013/04/17/3026694.html
  https://www.cnblogs.com/dasn/articles/5566001.html
  linux下修改内核参数进行Tcp性能调优 -- 高并发
  https://blog.csdn.net/wwh578867817/article/details/46707389

页: [1]
查看完整版本: CentOS6.8系统内核参数优化