php-fpm配置问题

WBOY
Release: 2016-06-06 20:24:55
Original
1313 people have browsed it

请大家帮忙看看下面的配置是否合理?

<code>pm = dynamic
pm.max_children = 40
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 40
 
pm.max_requests = 5000</code>
Copy after login
Copy after login

我一直以为 max_spare_servers是指定最大的空闲php进程数量,在一台机器上跑了若干个运行php环境的docker实例,如果空闲的实例也一直保持40个空闲进程,是否会导致资源利用不均衡或者其他繁忙的实例资源不足?

回复内容:

请大家帮忙看看下面的配置是否合理?

<code>pm = dynamic
pm.max_children = 40
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 40
 
pm.max_requests = 5000</code>
Copy after login
Copy after login

我一直以为 max_spare_servers是指定最大的空闲php进程数量,在一台机器上跑了若干个运行php环境的docker实例,如果空闲的实例也一直保持40个空闲进程,是否会导致资源利用不均衡或者其他繁忙的实例资源不足?

会! 空闲的进程不但要占着内存,而且还要占着上次请求里没有释放的内存,如果最大空闲量开得过大,很容易内存飙高而且长时间不回落(可以通过监控看到)。
建议最大空闲不要开太多,另外 pm.max_requests 可以有效降低刚才说的那种情况,5000还是比较合适的。

空闲进程不占CPU,只会占用一定的内存。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template