伺服器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 = dynamic
pm.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問題,謝謝!
怪我咯2017-05-16 17:17:48
pm = dynamic
pm.max_children = 400
pm.start_servers = 80
pm.min_spare_servers = 40
pm.max_spare_servers = 240
調小,這些設定的太大了,頻繁的IO切換,你現在似乎死的很慘。而且你少了pm.max_requests
用下面這個配置。
pm = dynamic
pm.max_children = 64
pm.start_servers = 32
pm.min_spare_servers = 16
pm.max_spare_servers = 32
pm.max_requests = 5000