My php fpm process gives me the following warning:
[29-Apr-2014 13:06:10] WARNING: [pool www] seems busy (you may need to
increase pm.start_servers, or pm.min/max_spare_servers), spawning 8
children, there are 19 idle, and 51 total children
[29-Apr-2014 13:07:09] WARNING: [pool www] seems busy (you may need to increase
pm.start_servers, or pm.min/max_spare_servers), spawning 8 children,
there are 14 idle, and 47 total children [29-Apr-2014 13:07:10]
WARNING: [pool www] seems busy (you may need to increase
pm.start_servers, or pm.min/max_spare_servers), spawning 16 children,
there are 17 idle, and 53 total children [29-Apr-2014 13:07:11]
WARNING: [pool www] seems busy (you may need to increase
pm.start_servers, or pm.min/max_spare_servers), spawning 32 children,
there are 14 idle, and 56 total children [29-Apr-2014 13:07:12]
WARNING: [pool www] seems busy (you may need to increase
pm.start_servers, or pm.min/max_spare_servers), spawning 32 children,
there are 19 idle, and 62 total children [29-Apr-2014 13:07:13]
WARNING: [pool www] seems busy (you may need to increase
pm.start_servers, or pm.min/max_spare_servers), spawning 32 children,
there are 18 idle, and 63 total children [29-Apr-2014 13:07:14]
My fpm.conf is :
pm.max_children = 161
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 40
pm.max_requests = 1000
My questions are
why are children being spawned even if I am not reaching the max_children value? Is it because of extra traffic and because the idle children need to reach the minimum of 20 they can not be used up?
Is this creating an overhead on my system?
Because that's the maximum. Once you hit the maximum, no more will be created, but up until that point PHP-FPM will add workers when it needs the extra capacity. With your settings, you'll always have at least 20 servers, no more than 161, and FPM will add servers when less than 20 are idle and remove servers when more than 40 are idle.
You have
pm.min_spare_servers = 20
, and it's going under the 20 idle children limit and spawning more to get back up to the min_spare_servers amount. Lower this to reduce how often it happens. It's meant to counteract load spikes and have enough children to meet demand.