4

I have installed ngix + php5-fpm. I am happy with it but I can not optimize php5-fpm so that it works without errors. Each fixed error creates a different error.

First I had the the default settings which causet a lot of errors:

[04-Jun-2012 03:30:06] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

I increased all numbers:

pm.max_children = 15
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 5
;pm.max_requests = 500

It caused a different error:

[28-Feb-2013 07:45:06] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 18 idle, and 28 total children

I increased all numbers again:

pm.max_children = 70
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 35
;pm.max_requests = 500

This caused logfile filling up with this:

[28-Feb-2013 13:21:55] NOTICE: [pool www] child 21868 exited with code 0 after 4171.293476 seconds from start
[28-Feb-2013 13:21:55] NOTICE: [pool www] child 23962 started

I uncommented:

pm.max_requests = 500

I had the same errors, but not so often - every 5 minutes:

[28-Feb-2013 13:21:55] NOTICE: [pool www] child 21868 exited with code 0 after 4171.293476 seconds from start
[28-Feb-2013 13:21:55] NOTICE: [pool www] child 23962 started

I did increase again:

pm.max_requests = 1000

Now I have this error 2-3 times per hour but it still persists.

I would increase this number again but I feel that my server (websites) work a bit slower than websites hosted on another server with settings: pm.max_children = 15,pm.start_servers = 5, pm.min_spare_servers = 3, pm.max_spare_servers = 5. (probably it's just a network issue, I don't know).

I have searched Google and this website and know how to calculate the pm.max_children (it depends of RAM). But I can not find any information how to calculate:

    pm.start_servers
    pm.min_spare_servers
pm.max_spare_servers
    pm.max_requests

Can somebody help?

uptime
 13:55:39 up 16:40,  2 users,  load average: 0.13, 0.14, 0.16


free -m
             total       used       free     shared    buffers     cached
Mem:         24101       3783      20318          0        151       3039
-/+ buffers/cache:        592      23509
Swap:         7811          0       7811

I did not change anything in nginx configuration files.

5
  • It sounds like you have done all the correct steps to tune PHP-FPM. What problem are you having? Feb 28, 2013 at 23:18
  • The problem is the following lines in php5-fpm.log. Is it normal? [28-Feb-2013 13:21:55] NOTICE: [pool www] child 21868 exited with code 0 after 4171.293476 seconds from start [28-Feb-2013 13:21:55] NOTICE: [pool www] child 23962 started Mar 1, 2013 at 5:39
  • That's normal since you set pm.max_requests. Mar 1, 2013 at 5:41
  • ok, but what is the purpose of pm.max_requests? By default is not activated. Mar 2, 2013 at 9:44
  • 2
    As far as I know, it will kill the child and so force the creation of a new child. This will reduce the damage done by memory leaks, as all memory of the child is freed when killed. Apr 3, 2013 at 19:57

2 Answers 2

2

As it says in the log [NOTICE]: this is informational and not an error. These are marked [ERROR].

So in short: nothing to worry about. It's like your kid telling you they switched off the light in the kitchen.

If it says [WARNING] that's something you should take care of, like you did in your first response by increasing the thresholds.

0

Switch php-fpm to dynamic mode. That way php-fpm automatically decides when to spawn new children. It is must have if you're using and type of opcode caches, because force-killed children increase fragmentation in PHP-APC

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .