首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >php:帮助理解start_servers,min_spare_servers,max_spare_servers

php:帮助理解start_servers,min_spare_servers,max_spare_servers
EN

Server Fault用户
提问于 2017-02-16 04:05:30
回答 1查看 23.7K关注 0票数 15

我正试图调优我的服务器的php安装,我很难弄清楚如何处理pm.start_serverspm.min_spare_serverspm.max_spare_servers变量。我正在使用pm = dynamic

pm.max_children是非常清楚的。每个子进程一次为一个web客户端服务。好的。那么什么是“服务器”呢?显然,根据我的默认配置,1台服务器可以为多个子服务器提供服务。上限是多少?对于#的子/服务器,我应该使用什么作为经验规则?或者这有关系吗?在一些论坛上,有人声称#的服务器应该是2x#的cpu核心,但我已经看到了建议的配置,那里的数目要高得多,40-50。

PHP文档和许多“调优php”文章都没有任何帮助。

EN

回答 1

Server Fault用户

回答已采纳

发布于 2017-02-16 04:50:45

基本上,php在任何时候运行的进程数在设置为dynamic时都是非常可配置的,就像您所做的那样。当设置为static时,总是会有许多子进程在运行。通常,您可以将其设置为动态,以节省资源。每个子进程可以处理一个请求。上限取决于您的php应用程序有多重,以及您得到了多少流量。您还应该计算每个子程序的平均内存消耗,并确保不允许在服务器上安装的子内存数量超过内存数量,否则将开始交换,甚至让内核开始杀死进程。

代码语言:javascript
复制
; 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.

在设置这些选项时,请考虑以下几点:

  • 你的平均要求是多长时间?
  • 网站(S)的最大同时访问者数是多少?
  • 每个子进程平均消耗多少内存?
票数 21
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/832832

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档