http - php-fpm 每天停止多次

标签 http nginx centos php centos6

我在 Centos 6 服务器上安装了一个 Wordpress 繁忙的博客:

CPU:Intel Xeon E3 1245v2 - 4 核 - 8 线程 内存:32 转 DDR3

Nginx、PHP-FPM 和 APC

版本:

PHP 5.4.9 (fpm-fcgi)(构建时间:2012 年 11 月 22 日 11:33:35)

nginx版本:nginx/1.2.5

该网站在第一天运行,我使用 UNIX 套接字而不是 TCP

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

我增加了 pm.max_children 的值但没有成功

PHP-FPM 配置:

; 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

默认池配置:

; 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

最佳答案

PHP 进程在无限期运行时并不是特别可靠。您应该配置 php-fpm 以不时地重新启动工作进程。尝试改变

    ;pm.max_requests = 500

进入

    pm.max_requests = 500

开始。这可能无法解决所有问题,因为您可能还有其他配置问题,但更改 max_requests 是一个好的开始。我的服务器已经运行了几个月,没有任何停机时间。

关于http - php-fpm 每天停止多次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13879680/

相关文章:

php - nginx:连接到上游时连接()失败(111:连接被拒绝)

git - 在主目录中安装 Git - CentOS 5 - 无根

angular - 如何通过符号链接(symbolic link)或存储库导出和集成独立的 Angular 模块?

java - 请求中不存在 'Access-Control-Allow-Origin' header

http - 如何在node js中存储大型二进制文件?

nginx - Nginx仅在根域时重写

python3 无法识别安装的正确 python 3 版本(Centos 7)

http - Nginx 将 HTTP 重定向到 HTTPS 部分工作

发送文件后,Ubuntu 上的 Git 通过 HTTP(不是 HTTPS)推送挂起

ruby-on-rails - Sendmail 在 Linux 终端中工作,而不是在 Rails 3 中工作