1. 程式人生 > >php-fpm: 某項目網站頻繁出現503問題解決( WARNING: [pool www] server reached pm.max_children setting (50), consider raising it)

php-fpm: 某項目網站頻繁出現503問題解決( WARNING: [pool www] server reached pm.max_children setting (50), consider raising it)

www. 監控 arp https php-fpm配置 找到 class conf nbsp

服務是nginx+php-fpm配置,

在運行過一段時間後,會經常出現:

WARNING: [pool www] server reached pm.max_children setting (50), consider raising it
子進程達到最大數量,需要提供子進程數

  

503/502一般是因為服務器維護或者過載,近期服務器並未進行維護,查詢監控記錄發現負載也不是很高,猜測是不是服務器對項目的某些配置產生了限制,查看nginx,php日誌發現:

找到php-fpm.conf 文件 ,查找php日誌錯誤

[15-Nov-2017 15:23:51] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
[15-Nov-2017 17:10:53] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
[15-Nov-2017 17:12:56] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
[15-Nov-2017 18:29:28] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
[16-Nov-2017 10:25:17] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

  


該警告頻繁出現,子進程達到最大數量,查詢php-fpm配置文件www.conf,發現pm.max_children采用的是默認配置,顯然是因為設定值過小導致

問題解決:

修改

pm.start_servers = 10   //php-fpm啟動起始進程數
pm.min_spare_servers = 10   //php-fpm的最小空閑進程數
pm.max_spare_servers = 24   //php-fpm的最大空閑進程數
pm.max_requests = 500   //所有子進程重啟時間

  

參考:https://lirongyao.com/server-reached-pm-max_children-setting.html

php-fpm: 某項目網站頻繁出現503問題解決( WARNING: [pool www] server reached pm.max_children setting (50), consider raising it)