dongqiao1964 2012-12-14 13:34
浏览 76
已采纳

php-fpm每天停多次

I installed on a Centos 6 Server to host a Wordpress busy blog:

CPU: Intel Xeon E3 1245v2 - 4 Cores - 8 Threads RAM: 32 Go DDR3

Nginx, PHP-FPM, and APC

Version:

PHP 5.4.9 (fpm-fcgi) (built: Nov 22 2012 11:33:35)

nginx version: nginx/1.2.5

The website was working first days, and I used UNIX sockets instead of TCP

Error Log of PHP-FPM:

[14-Dec-2012 01:33:45] WARNING: [pool www] seems busy (you may need to increase                                                                                         pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are                                                                                         3 idle, and 205 total children
[14-Dec-2012 01:34:08] WARNING: [pool www] seems busy (you may need to increase                                                                                         pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 3                                                                                         idle, and 222 total children
[14-Dec-2012 01:34:35] WARNING: [pool www] seems busy (you may need to increase                                                                                         pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0                                                                                         idle, and 240 total children
[14-Dec-2012 01:34:44] WARNING: [pool www] server reached pm.max_children settin                                                                                        g (250), consider raising it
[14-Dec-2012 14:21:22] NOTICE: Terminating ...
[14-Dec-2012 14:21:22] NOTICE: exiting, bye-bye!
[14-Dec-2012 14:21:23] NOTICE: fpm is running, pid 2345
[14-Dec-2012 14:21:23] NOTICE: ready to handle connections
[14-Dec-2012 14:21:30] WARNING: [pool www] seems busy (you may need to increase                                                                                         pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 4                                                                                         idle, and 9 total children
[14-Dec-2012 14:24:39] WARNING: [pool www] child 2354 exited on signal 7 (SIGBUS                                                                                        ) after 191.690193 seconds from start
[14-Dec-2012 14:24:39] NOTICE: [pool www] child 2510 started

I increased pm.max_children value but without any success

PHP-FPM Config:

; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
emergency_restart_threshold = 10

; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated.  This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
emergency_restart_interval = 1m

; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
process_control_timeout = 10s

Default Pool config:

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes to be created when pm is set to 'dynamic'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI.
; Note: Used when pm is set to either 'static' or 'dynamic'
; Note: This value is mandatory.
pm.max_children = 250

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 5

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 5

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 70

; 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
  • 写回答

1条回答 默认 最新

  • dongyun4010 2012-12-17 21:02
    关注

    PHP processes are not particularly reliabile when left running indefinitely. You should configure php-fpm to restart the worker processes every now-and-then often. Try changing

        ;pm.max_requests = 500
    

    into

        pm.max_requests = 500
    

    for a start. That might not fix everything as you may possibly have other configuration problems, but changing max_requests is a good start. My server has been running for months without any downtime.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能