php-fpm:数百秒的记录


12

我有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

Answers:


20

“秒”是时间单位;其中321 分钟超过5分钟

您的进程退出并重新生成的原因是您已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个请求后将回收该过程。


因此,这意味着只有具体线程存活了321几秒钟,才会重新生成。我可以不注意吗?
Lari13 2013年

1
您可以忽略这些消息。它们是无害的,纯粹是信息性的。
迈克尔·汉普顿

通过将log_level参数php-fpm.confnotice(可能是默认值)提高到warning
Paolo

2

max_requests说的是什么?如果这是一个繁忙的网站,则一旦遇到该数量的请求,它很可能会回收其子进程-除非它表示为0,否则它可能会遇到内部超时并关闭子进程以节省安静时间的内存。我知道IIS的FastCGI处理器可以做到这一点。这里可能是同样的情况。

Src:http//php-fpm.org/wiki/Configuration_File

编辑:那就是正在发生的事情。一旦一个孩子达到100个请求,它就会关闭。然后,PHP-FPM将在需要时打开一个新的(可能会立即)。


pm.max_requests = 100在我的配置中。Plase,请参阅更新
Lari13
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.