服务器已达到 pm.max_children 设置

服务器已达到 pm.max_children 设置

我在 Nginx 和 FPM 下运行 WordPress 网站。如果流量过大,它会终止 php 进程,网站将停止为所有用户服务。以下是我从日志中发现的内容。

有没有什么办法可以让网站不停止工作,但如果请求量超过我们配置的数量,网站就会变得繁忙,或者以其他方式对新用户不起作用,但对于老用户来说它可以正常工作(不要停止整个网站)。

[20-Mar-2016 03:34:01] NOTICE: error log file re-opened
[21-Mar-2016 05:51:44] 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 27 total children
[23-Mar-2016 06:56:13] WARNING: [pool www] child 8707 exited on signal 11 (SIGSEGV) after 231123.827974 seconds from start
[23-Mar-2016 06:56:13] NOTICE: [pool www] child 14407 started
[23-Mar-2016 07:00:03] WARNING: [pool www] server reached pm.max_children setting (50), consider raising it
[23-Mar-2016 07:08:55] NOTICE: Terminating ...
[23-Mar-2016 07:08:55] NOTICE: exiting, bye-bye!

答案1

根据 RAM 的数量,您可以在服务器上使用更多的 PHP 子项。

如果您不确定您的发行版中 FPM 的配置文件在哪里,您可以运行以下命令:grep -R max_children /etc

本文非常简单地解释了您应该做什么。 http://myshell.co.uk/blog/2012/07/adjusting-child-processes-for-php-fpm-nginx/

此外,如果启用缓存是一种选择,扩展将使网站速度提高约 10 倍。

相关内容