说明:本人不太懂技术,方案是整理而来,不一定好,请慎用。
一、nginx优化
/etc/nginx/nginx.conf
worker_processes设为auto
添加worker_rlimit_nofile 65535;
worker_connections调大,比如20480
https://blog.csdn.net/sh2018/article/details/104188760
二、php进程优化
适当提高pm.max_children、pm.max_spare_servers
注意:pm.start_servers<=pm.min_spare_servers<pm.max_spare_servers<=pm.max_children
比如
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 50
三、backlog优化
1、修改内核,在/etc/sysctl.conf中添加
net.ipv4.tcp_max_syn_backlog = 4096
net.core.netdev_max_backlog = 4096
2、php-fpm配置修改
/data/mystack/sites/www.888.com/conf/php-1.conf
把listen.backlog = -1修改成listen.backlog = 4096
3、nginx配置修改
/data/mystack/sites/www.888.com/conf/nginx.conf
把listen 80;修改成listen 80 default backlog=4096;
最后重启php、nginx即可
https://blog.csdn.net/sh2018/article/details/105342031