php-fpm:日誌中數百秒

php-fpm:日誌中數百秒

我有 nginx+php-fpm 網路伺服器

所以我在 php5-fpm.log 中註意到許多奇怪的行:

[03-Sep-2013 09:25:23] NOTICE: [pool www] child 23999 exited with code 0 after 321.832329 seconds from start
[03-Sep-2013 09:25:23] NOTICE: [pool www] child 24082 started
[03-Sep-2013 09:25:41] NOTICE: [pool www] child 24032 exited with code 0 after 259.247887 seconds from start
[03-Sep-2013 09:25:41] NOTICE: [pool www] child 24083 started
[03-Sep-2013 09:25:47] NOTICE: [pool www] child 24033 exited with code 0 after 255.954602 seconds from start
[03-Sep-2013 09:25:47] NOTICE: [pool www] child 24084 started
[03-Sep-2013 09:25:50] NOTICE: [pool www] child 24014 exited with code 0 after 327.620462 seconds from start
[03-Sep-2013 09:25:50] NOTICE: [pool www] child 24085 started
[03-Sep-2013 09:25:55] NOTICE: [pool www] child 24034 exited with code 0 after 254.974653 seconds from start
[03-Sep-2013 09:25:55] NOTICE: [pool www] child 24086 started
[03-Sep-2013 09:26:01] NOTICE: [pool www] child 24035 exited with code 0 after 253.388234 seconds from start
[03-Sep-2013 09:26:01] NOTICE: [pool www] child 24087 started
[03-Sep-2013 09:26:02] NOTICE: [pool www] child 24036 exited with code 0 after 251.374430 seconds from start
[03-Sep-2013 09:26:02] NOTICE: [pool www] child 24088 started
[03-Sep-2013 09:26:05] NOTICE: [pool www] child 24019 exited with code 0 after 325.601766 seconds from start
[03-Sep-2013 09:26:05] NOTICE: [pool www] child 24089 started
[03-Sep-2013 09:26:09] NOTICE: [pool www] child 24037 exited with code 0 after 255.871955 seconds from start
[03-Sep-2013 09:26:09] NOTICE: [pool www] child 24090 started
[03-Sep-2013 09:26:09] NOTICE: [pool www] child 24038 exited with code 0 after 255.884311 seconds from start
[03-Sep-2013 09:26:09] NOTICE: [pool www] child 24091 started
[03-Sep-2013 09:26:09] NOTICE: [pool www] child 24039 exited with code 0 after 254.826181 seconds from start
[03-Sep-2013 09:26:09] NOTICE: [pool www] child 24092 started
[03-Sep-2013 09:26:12] NOTICE: [pool www] child 24040 exited with code 0 after 256.232759 seconds from start
[03-Sep-2013 09:26:12] NOTICE: [pool www] child 24093 started
[03-Sep-2013 09:26:14] NOTICE: [pool www] child 24027 exited with code 0 after 321.722533 seconds from start

誰能告訴我,這些秒數是什麼樣的after 321.722533 seconds from start,這又代表什麼?

UPD

我的配置是:

pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 100

答案1

「秒」是時間單位;其中321個是五分鐘多一點

您的進程退出並重新產生的原因是您已pm.max_requests在 php-fpm 池設定檔中設定了該選項。

例如,取自預設配置:

; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 500

我們可以看到在你的配置將其設為100,因此 php-fpm 在處理 100 個請求後會回收該進程。

答案2

你的設定說什麼max_requests?如果這是一個繁忙的網站,一旦達到該數量的請求,它可能會回收其子進程- 除非它顯示0,在這種情況下,它可能會遇到內部超時並關閉子進程以在安靜時間節省內存。我知道 IIS 的 FastCGI 處理器可以做到這一點;這裡可能也是同樣的情況。

來源:http://php-fpm.org/wiki/Configuration_File

編輯:那就是發生的事情。一旦一個孩子達到 100 個請求,它就會關閉。然後,PHP-FPM 將在需要時(可能是立即)開啟一個新的。

相關內容