大网数据广告活动
服务器运维问答

php5-fpm: server reached pm.max_children

· 52CE 我爱测

I have NGINX and php5-fpm . Several times per hour my website stucks and in logfile I see the following: WARNING: [pool www] server reached pm.max_children setting (5), consider raising it. The /etc/php5/fpm/pool.d/www.conf file …

问题原文

原帖链接 · user1821484 · CC BY-SA 4.0

I have NGINX and php5-fpm. Several times per hour my website stucks and in logfile I see the following:

WARNING: [pool www] server reached pm.max_children setting (5), consider raising it.

The /etc/php5/fpm/pool.d/www.conf file contains the following configuration:

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

Server: AMD Opteron™ 3280, Octo-Core, 8x 2.4 GHz, 16 GB DIMM (DDR3).

What numbers should I put in www.conf file for this server?

已采纳解答

原帖链接 · replay · CC BY-SA 4.0

There are many possible reasons why your PHP-FPM would reach the max_children. Most common ones are:

  • A lot of parallel requests from your clients
  • Slow execution of the PHP scripts
  • Very low setting of the max_children

Looking at the specs of your machine, assuming there is nothing else than PHP+Nginx running, I think you could set it much higher than 5. You say you have 8 Cores, usually Nginx needs much less CPU than PHP, so with 5 children you will probably never be able to use all of them. I'm usually setting it to something like the number of cores x 2 or number of cores x 4, depending on the memory consumption of your PHP scripts.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-02-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。