Php-fpm configuration: encountered and error

I'm a little confused ;)

For a 32 GB ram Server (8 core) and a lot of free mem and a lot of local pictures on it, is this your best php config?

Code:
pm = dynamic
pm.max_children = 32
pm.start_servers = 6
pm.min_spare_servers = 4
pm.max_spare_servers = 10
pm.max_requests = 100
 
I'm a little confused ;)

For a 32 GB ram Server (8 core) and a lot of free mem and a lot of local pictures on it, is this your best php config?

Code:
pm = dynamic
pm.max_children = 32
pm.start_servers = 6
pm.min_spare_servers = 4
pm.max_spare_servers = 10
pm.max_requests = 100
I can't say it's the best because with that config I'm still getting warning :/
 
With this settings:
Code:
pm = dynamic
pm.max_children = 32
pm.start_servers = 8
pm.min_spare_servers = 4
pm.max_spare_servers = 12
pm.max_requests = 100
I'm still getting this warning :(
Code:
[15-Aug-2014 23:03:18] 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 19 total children
[15-Aug-2014 23:03:19] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 23 total children
[15-Aug-2014 23:03:20] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 27 total children
[15-Aug-2014 23:03:21] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 31 total children
[15-Aug-2014 23:03:22] WARNING: [pool www] server reached pm.max_children setting (32), consider raising it
[16-Aug-2014 17:40: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 19 total children
[16-Aug-2014 17:40:36] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 23 total children
[16-Aug-2014 17:40:37] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 27 total children
[16-Aug-2014 17:40:38] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 31 total children
[16-Aug-2014 17:40:39] WARNING: [pool www] server reached pm.max_children setting (32), consider raising it
[16-Aug-2014 22:50:45] 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 19 total children
[16-Aug-2014 22:50:46] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 3 idle, and 23 total children
 
With this settings:
Code:
pm = dynamic
pm.max_children = 32
pm.start_servers = 8
pm.min_spare_servers = 4
pm.max_spare_servers = 12
pm.max_requests = 100
I'm still getting this warning :(
Code:
[15-Aug-2014 23:03:18] 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 19 total children
[15-Aug-2014 23:03:19] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 23 total children
[15-Aug-2014 23:03:20] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 27 total children
[15-Aug-2014 23:03:21] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 31 total children
[15-Aug-2014 23:03:22] WARNING: [pool www] server reached pm.max_children setting (32), consider raising it
[16-Aug-2014 17:40: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 19 total children
[16-Aug-2014 17:40:36] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 23 total children
[16-Aug-2014 17:40:37] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 27 total children
[16-Aug-2014 17:40:38] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 31 total children
[16-Aug-2014 17:40:39] WARNING: [pool www] server reached pm.max_children setting (32), consider raising it
[16-Aug-2014 22:50:45] 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 19 total children
[16-Aug-2014 22:50:46] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 3 idle, and 23 total children

pm.max_children = 32 when you are under heavy load, watch your CPU die, that's what is happening. I had the same issue and turning those numbers down is actually better for you sometimes.

Code:
pm.max_children = 8
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6

wordpress frontpage

Code:
Document Path:          /
Document Length:        13414 bytes

Concurrency Level:      100
Time taken for tests:   0.915 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      137028813 bytes
HTML transferred:       134354007 bytes
Requests per second:    10929.14 [#/sec] (mean)
Time per request:       9.150 [ms] (mean)
Time per request:       0.091 [ms] (mean, across all concurrent requests)
Transfer rate:          146250.70 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1    3   0.4      3       7
Processing:     2    6   2.0      6     188
Waiting:        0    4   2.0      4     186
Total:          3    9   2.1      9     195

forum index

Code:
Concurrency Level:      100
Time taken for tests:   42.973 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      673120000 bytes
HTML transferred:       669290000 bytes
Requests per second:    232.70 [#/sec] (mean)
Time per request:       429.732 [ms] (mean)
Time per request:       4.297 [ms] (mean, across all concurrent requests)
Transfer rate:          15296.60 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.6      0       8
Processing:    34  427  34.3    425     529
Waiting:       34  427  34.3    425     528
Total:         42  427  34.0    425     529

busy forum page full of attachments/gifs, 20 posts per page.

Code:
Concurrency Level:      100
Time taken for tests:   92.493 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Non-2xx responses:      10000
Total transferred:      205010000 bytes
HTML transferred:       200420000 bytes
Requests per second:    108.12 [#/sec] (mean)
Time per request:       924.929 [ms] (mean)
Time per request:       9.249 [ms] (mean, across all concurrent requests)
Transfer rate:          2164.55 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.3      0       5
Processing:    66  920  98.5    900    1357
Waiting:       66  920  98.5    900    1357
Total:         70  920  98.4    900    1357

Capture.webp

The kind of pm.max_children settings you have killed my forum under load. Assume each worker will consume 100% of a cpu core when pushed. I'm a lot comfortable with 1000+ people on the forums with these lower settings. Try some benchmarks with both settings and see how you fare either way.
 
Last edited:
  • Like
Reactions: rdn
pm.max_children = 32 when you are under heavy load, watch your CPU die, that's what is happening. I had the same issue and turning those numbers down is actually better for you sometimes.

Code:
pm.max_children = 8
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6

wordpress frontpage

Code:
Document Path:          /
Document Length:        13414 bytes

Concurrency Level:      100
Time taken for tests:   0.915 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      137028813 bytes
HTML transferred:       134354007 bytes
Requests per second:    10929.14 [#/sec] (mean)
Time per request:       9.150 [ms] (mean)
Time per request:       0.091 [ms] (mean, across all concurrent requests)
Transfer rate:          146250.70 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1    3   0.4      3       7
Processing:     2    6   2.0      6     188
Waiting:        0    4   2.0      4     186
Total:          3    9   2.1      9     195

forum index

Code:
Concurrency Level:      100
Time taken for tests:   42.973 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      673120000 bytes
HTML transferred:       669290000 bytes
Requests per second:    232.70 [#/sec] (mean)
Time per request:       429.732 [ms] (mean)
Time per request:       4.297 [ms] (mean, across all concurrent requests)
Transfer rate:          15296.60 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.6      0       8
Processing:    34  427  34.3    425     529
Waiting:       34  427  34.3    425     528
Total:         42  427  34.0    425     529

busy forum page full of attachments/gifs, 20 posts per page.

Code:
Concurrency Level:      100
Time taken for tests:   92.493 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Non-2xx responses:      10000
Total transferred:      205010000 bytes
HTML transferred:       200420000 bytes
Requests per second:    108.12 [#/sec] (mean)
Time per request:       924.929 [ms] (mean)
Time per request:       9.249 [ms] (mean, across all concurrent requests)
Transfer rate:          2164.55 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.3      0       5
Processing:    66  920  98.5    900    1357
Waiting:       66  920  98.5    900    1357
Total:         70  920  98.4    900    1357

View attachment 85848

The kind of pm.max_children settings you have killed my forum under load. Assume each worker will consume 100% of a cpu core when pushed. I'm a lot comfortable with 1000+ people on the forums with these lower settings. Try some benchmarks with both settings and see how you fare either way.
And your server specs?
CPU, cores, thread and ram?
Thanks for your input.
 
Just change back to:
Code:
pm.max_children = 16
pm.start_servers = 6
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 100
 
And your server specs?
CPU, cores, thread and ram?
Thanks for your input.
8 core / 12GB on our smaller server... There are formula online for this with ram and number of processes but as usual it's cut paste crap not worth the time. Do your own observations and stress test, best way. Cpu is the problem when you have 32 workers but no 32 cpus and the load is extreme.
 
Last edited:
8 core 12GB small? I run 4 core 7GB servers with max_children set at 64 (static), the bottleneck is CPU but the servers are coping just fine, and we aren't exactly a small installation. We will avoid image proxy, anything that has a reliance on external services is bad in my book. But you also need to address sysctl.conf unless you prefer to spend more money on bigger servers.
 
Image Proxy can be tweak to avoid it hogging your resource.
I'm yet to try this one at al, we're getting close to 160,000 image attachments but I really prefer people upload directly than link in. Nothing worse than clicking a page and waiting for 13 other websites to load some .gifs
 
Top Bottom