在我这台小服务器上搭建的NGINX+PHP+MYSQL环境中,有时进行某种WEB操作会奇卡无比,于此查看FPM在CPU的占用情况,但只消耗了连1%都不到。

于是经过各种资料查看,更改以下文件的配置即可:

官方给出的说明:

; 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. With this process management, there will be
; always at least 1 children.
; 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.
; ondemand – no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children – the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout – The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.

我修改的配置:


以上结束,有时候还需要在NGINX/PHP-FPM的配置文件中定义各种的超时时间,并且修改的配置要以机器性能而定。

分类: PHP

0 条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据