gpt4 book ai didi

nginx - 什么是 PHP-FPM 池,什么是 pm.max_children?

转载 作者:行者123 更新时间:2023-12-04 02:09:34 27 4
gpt4 key购买 nike

我有一个带有 NGINX 和 PHP-FPM 的 Drupal 站点,带有 3 个池。

我想知道什么是 FPM 池,或者只是给我一些好的文档的链接,我已经搜索过这个主题,但我发现的只是如何配置“X”以获得更好的性能。

此外,什么是 pm.max_children?我最近在日志中注意到,当池 www1 达到此值时,池 www1 停止工作,同时锁定我网站上的一个页面,直到我重新加载 PHP-FPM。为什么我在一段时间后到达 pm.max_children?有没有办法检测并在此事件中使用react...重新加载 PHP-FPM?有没有办法避免达到 pm.max_children?

感谢大家的知识。

PD:我正在为 Drupal 和 Nginx 使用 perusio 的配置。

最佳答案

好吧,你可以简单地说每个池就像一个单独的 php,就像我使用池来由不同的用户运行每个池,在资源方面给每个池适当的限制,例如在同一台服务器上运行的不同网站.

我不明白为什么同一个站点有 3 个池,你在 nginx 中使用 upstream 吗?

至于 max_children 是允许 fpm 产生以处理并发连接的衍生进程数量,如果您有很多并发连接,那么最好增加该数量,如果该数量是达到 fpm 不会产生另一个 child 并等待一个 child 有空来处理等待的请求。

编辑:

尝试使用这个配置,可能会有用,这里是配置文件的一个片段,默认情况下它是注释的。

; 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

还有一个

; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0

关于nginx - 什么是 PHP-FPM 池,什么是 pm.max_children?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19890094/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com