本文共 2045 字,大约阅读时间需要 6 分钟。
系统内核如下:
centos6.8[root@localhost ~]# uname -aLinux 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程序都是短链接优化如下:
[root@localhost ~]# cat /etc/sysctl.conf
net.ipv4.ip_forward= 0kernel.sysrq = 0
kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 68719476736kernel.shmall = 4294967296net.ipv4.tcp_syncookies = 1net.ipv4.tcp_synack_retries = 2net.ipv4.tcp_syn_retries = 2vm.overcommit_memory = 1net.ipv4.tcp_max_syn_backlog = 1638400net.core.somaxconn = 1638400net.core.netdev_max_backlog = 20000net.ipv4.tcp_max_tw_buckets = 1800000net.ipv4.conf.all.send_redirects = 0net.ipv4.conf.all.accept_redirects = 0net.ipv4.tcp_fin_timeout = 10net.ipv4.tcp_keepalive_time = 90net.ipv4.ip_local_port_range = 1024 65000net.ipv4.tcp_window_scaling = 1net.ipv4.icmp_echo_ignore_all = 0net.ipv4.icmp_echo_ignore_broadcasts = 1net.ipv4.tcp_sack = 0net.ipv4.tcp_keepalive_probes = 5net.ipv4.tcp_keepalive_intvl = 30net.ipv4.tcp_retries2 = 5net.ipv4.tcp_max_orphans = 262144net.ipv4.tcp_orphan_retries = 3net.ipv4.tcp_reordering = 5net.ipv4.tcp_retrans_collapse = 0net.ipv4.tcp_wmem = 51200 131072 4194304net.ipv4.tcp_rmem = 51200 131072 4194304net.ipv4.tcp_timestamps = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1net.netfilter.nf_conntrack_max = 655350
net.netfilter.nf_conntrack_tcp_timeout_established = 90net.netfilter.nf_conntrack_tcp_timeout_close_wait = 30net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 60net.netfilter.nf_conntrack_tcp_timeout_time_wait = 60[root@localhost ~]#
优化后的并发可以单台服务器可以达到:61525[root@localhost ~]# date2017年 11月 29日 星期三 22:23:51 CST[root@localhost ~]# ss -ant | awk 'NR>1 {++s[$1]} END {for(k in s) print k,s[k]}'LAST-ACK 327SYN-RECV 255ESTAB 61525FIN-WAIT-1 615CLOSING 6FIN-WAIT-2 15732TIME-WAIT 12157LISTEN 15参考地址:linux下修改内核参数进行Tcp性能调优 -- 高并发转载于:https://blog.51cto.com/shuosir/2116412