nginx - php fastcgi進程數設為0好嗎,該如何設?
黄舟
黄舟 2017-05-16 17:15:48
0
1
1367

伺服器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問題,謝謝!

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全部回覆(1)
刘奇
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   
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板