问题描述
服务器4核8G内存,cpu(30-50%),内存(40-50%)每天都会出现几次502查了一下netstat -anpo | grep 'php-cgi' | wc -l 是3
以下是我的/usr/local/php/etc/php-fpm.conf 内容
[global]pid = /usr/local/php/var/run/php-fpm.pid error_log = /data/logs/php-fpm-error.log log_level = notice [www] listen = /tmp/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www listen.group = www listen.mode = 0777 user = www group = www pm = dynamicpm.max_children = 400 pm.start_servers = 80 pm.min_spare_servers = 40 pm.max_spare_servers = 240 request_terminate_timeout = 100 request_slowlog_timeout = 3 slowlog = /data/logs/php_slow.log
nginx error 日志中有很多fastcgi request record is too big错误是什么原因?
请朋友们帮忙看如何处理我的502问题,谢谢!
问题解答
回答1:pm = dynamicpm.max_children = 400 pm.start_servers = 80 pm.min_spare_servers = 40 pm.max_spare_servers = 240
调小,这些设置的太大了,频繁的IO切换,你现在似乎死的很惨。而且你少了pm.max_requests用下面这个配置。
pm = dynamicpm.max_children = 64 pm.start_servers = 32 pm.min_spare_servers = 16 pm.max_spare_servers = 32pm.max_requests = 5000