php fpm服務掛掉

2022-05-09 20:20:40 字數 2754 閱讀 8798

[04-apr-2016 15:38:04] notice: systemdmonitorintervalsetto 10000ms

[05-apr-2016 19:03:08] warning: [poolwww] seemsbusy (youmayneedto increasepm.start_servers, or pm.min/max_spare_servers), spawning 8 children, thereare 0 idle, and 29 totalchildren

[05-apr-2016 19:03:09] warning: [poolwww] seemsbusy (youmayneedto increasepm.start_servers, or pm.min/max_spare_servers), spawning 16 children, thereare 0 idle, and 34 totalchildren

[05-apr-2016 19:03:11] warning: [poolwww] seemsbusy (youmayneedto increasepm.start_servers, or pm.min/max_spare_servers), spawning 32 children, thereare 0 idle, and 39 totalchildren

[05-apr-2016 19:03:12] warning: [poolwww] seemsbusy (youmayneedto increasepm.start_servers, or pm.min/max_spare_servers), spawning 32 children, thereare 0 idle, and 44 totalchildren

[05-apr-2016 19:03:13] warning: [poolwww] seemsbusy (youmayneedto increasepm.start_servers, or pm.min/max_spare_servers), spawning 32 children, thereare 0 idle, and 49 totalchildren

[05-apr-2016 19:03:14] warning: [poolwww] serverreachedpm.max_children setting (50), considerraisingit

錯誤提示建議增加pm.start_servers數量,開啟我的php-fpm配置:

pm.max_children = 50

; thenumberofchild processescreatedonstartup.

; note: usedonlywhenpmis setto 'dynamic'

; default value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2

pm.start_servers = 15

; thedesiredminimumnumberofidleserverprocesses.

; note: usedonlywhenpmis setto 'dynamic'

; note: mandatorywhenpmis setto 'dynamic'

pm.min_spare_servers = 5

; thedesiredmaximumnumberofidleserverprocesses.

; note: usedonlywhenpmis setto 'dynamic'

; note: mandatorywhenpmis setto 'dynamic'

pm.max_spare_servers = 35

這裡pm.start_servers之前我設定為5,注意配置檔案也說明start_servers的值預設是max_spare_servers-min_spare_servers的一半。(ps:具體的值要根據伺服器配置情況和壓力測試得出)

**伺服器是阿里雲1g頻寬,1g記憶體,1核cpu配置,關鍵還在一台機子上裝了資料庫,redis各種服務。

pm.max_children = 24
static模式下建立的子程序數或dynamic模式下同一時刻允許最大的php-fpm子程序數量

pm.start_servers = 16
動態方式下的起始php-fpm程序數量

pm.min_spare_servers = 12
動態方式下伺服器空閒時最小php-fpm程序數量

pm.max_spare_servers = 24
動態方式下伺服器空閒時最大php-fpm程序數量

經驗人士的總結:

一般php-fpm程序占用20~30m左右的記憶體就按30m算。如果單獨跑php-fpm,動態方式起始值可設定物理記憶體mem/30m,由於大家一般nginx、mysql都在一台機器上,於是預留一半給它們,即php-fpm程序數為$mem/2/30。

調整之後的幾個值是:

pm = dynamic

pm.max_children = 50

pm.start_servers = 15

pm.min_spare_servers = 10

pm.max_spare_servers = 40

重啟php-fpm服務:service php70-php-fpm reload,繼續使用top命令檢視記憶體使用情況,發現十幾個php-fpm啟動。

php fpm新增service服務

nginx通過fastcgi執行php比apache包含php環境有明顯的優勢,最近有訊息稱,php5.4將很有可能把php fpm補丁包含在核心裡,nginx伺服器平台上執行php將更加輕鬆,下面我們就來看一篇php fpm平滑啟動並配置服務例子。我的php是原始碼安裝的。php fpm在php ...

php fpm服務啟動指令碼

在 php fpm還是打補丁的時候,php fpm重啟只需要執行php fpm restart或者reload,自從php5.3之後,php fpm的啟動和停止顯得比較麻煩,特意改寫了乙份 nginx 的自啟動指令碼,如下指令碼phpfpm usr local php 5.3.10 sbin php...

服務監控 PHP FPM狀態監控

root linux node1 vim etc zabbix zabbix agentd.conf 編輯配置檔案引用key include etc zabbix zabbix agentd.d conf root linux node1 mkdir etc zabbix scripts 存放she...