Bin*_*ntz 12 php nginx php-fpm
我正在尝试为我的服务器调整我的 php-fpm 安装,但我无法弄清楚如何处理pm.start_servers
,pm.min_spare_servers
和pm.max_spare_servers
变量。我在用pm = dynamic
pm.max_children
非常清楚。每个子进程一次为 1 个 Web 客户端提供服务。好的。那么什么是“服务器”呢?显然,根据我的默认配置,1 个服务器可以为 1 个以上的孩子提供服务。上限是多少?我应该使用什么作为儿童/服务器数量的经验法则?或者它完全相关?在某个论坛上,有人声称服务器数量应该是 cpu 内核数的 2 x #,但我看到推荐的配置数量要高得多,40-50。
PHP 文档和许多“调整 php-fpm”文章都没有帮助。
gbo*_*olo 15
基本上,当您设置为dynamic
喜欢时,php-fpm 将在任何时间运行的进程数是非常可配置的。当设置为时,static
总会有那么多子进程在运行。通常,您将其设置为动态以节省资源。每个子进程可以处理一个请求。上限取决于您的 php 应用程序的重量以及您获得的流量。您还应该计算每个孩子的平均内存消耗,并确保您永远不会让孩子的数量超过服务器上安装的内存数量,否则您将开始交换甚至让内核开始杀死进程。
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives:
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; Note: This value is mandatory.
Run Code Online (Sandbox Code Playgroud)
设置这些选项时,请考虑以下事项:
归档时间: |
|
查看次数: |
16869 次 |
最近记录: |