什么是PHP-FPM池,什么是pm.max_children? [英] What are PHP-FPM pools and what is pm.max_children?

查看:89
本文介绍了什么是PHP-FPM池,什么是pm.max_children?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a Drupal site with NGINX and PHP-FPM with 3 pools.

我想知道什么是FPM池,或者只是给我提供了指向好的文档的链接,我已经搜索了这个主题,但是我发现的全部是如何配置"X"以获得更好的性能.

What I want to know is what are FPM pools or just give me links to good documentation, i've searched about this topic but all I found is how to configure "X" to obtain a better performance.

另外,pm.max_children是什么?我最近在日志中注意到,当池www1达到此值时,池www1停止工作,并在我的站点上也锁定了一个页面,直到我重新加载PHP-FPM.为什么一段时间后我到达pm.max_children?有没有一种方法可以在这种情况下检测并做出反应...重新加载PHP-FPM?有没有办法避免到达pm.max_children?

Also, what is pm.max_children? I recently notice in the log that when pool www1 reaches this value the pool www1 stops working, locking also a page on my site until I reload PHP-FPM. Why I'm reaching pm.max_children after some time? Is there a way to detect and react in this event... reloading PHP-FPM? Is there a way to avoid reaching pm.max_children?

感谢您的知识.

PD:我在Drupal和Nginx上使用perusio的配置.

PD: I'm using perusio's configuration for Drupal and Nginx.

推荐答案

您可以简单地说每个池就像一个单独的php,对我来说,我使用池由不同的用户运行,给每个池适当的限制就资源以及在同一服务器上运行的单独网站而言.

Well you can simply say that each pool is like a separate php, like for me i use pools to run each by a different user, give each the appropriate limits in terms of resources and such for separate websites running on the same server.

我不明白为什么同一个站点有3个池,您是否在nginx中使用上游?

I don't understand though why 3 pools for same site, do you use an upstream in nginx?

关于 max_children 是允许fpm生成以处理并发连接的已生成进程的数量,如果有很多并发连接,则最好增加该数量,如果数量为达到fpm不会产生另一个孩子并等待一个孩子释放以处理等待的请求.

As for max_children is the amount of spawned processes the fpm is allowed to spawn to handle concurrent connections, If you are having a lot of concurrent connections then you better increase that number, if the number is reached fpm won't spawn another child and wait for one to free to handle the waiting request.

编辑:

尝试使用此配置,可能会有用,这是配置文件的一部分,默认情况下带有注释.

Try playing with this config, might be useful, here's a snippet from the config file, by default it's commented.

; 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

这篇关于什么是PHP-FPM池,什么是pm.max_children?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆