PM on demand vs Dynamic?

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
In terms of speed, which is better for PHP-FPM configurations?
I see almost PHP-FPM have configurations like this

Code:
[pool_name]
...
pm = [B]dynamic[/B]
pm.max_children = 5
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 200
What if I change to

Code:
pm = ondemand
Any advice?
 

VirtuBox

Well-known member
Registered
Joined
May 3, 2016
Messages
1,622
Points
83
Hello djsmiley2k,

for the most part of websites, ondemand mode for php-fpm will be better than dynamic, because ondemand mode will spawn new php-fpm child process if needed and will kill them when child process are idle.
Here the configuration I use on my servers :
Code:
pm = ondemand
pm.max_children = 5
pm.max_spare_servers = 1
pm.min_spare_servers = 1
pm.process_idle_timeout = 10s
pm.start_servers = 1
 

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
djsmiley2k

I never known a way to configure like this line: pm = ondemandpm.max_children = 5
It is possible for type of servers?

and why you change to these? it is better than default settings?

Code:
pm.max_spare_servers = 1
pm.min_spare_servers = 1
pm.process_idle_timeout = 10s
pm.start_servers = 1
 

VirtuBox

Well-known member
Registered
Joined
May 3, 2016
Messages
1,622
Points
83
Sorry the was an error in my configuration when I have copied it, the correct configuration is :
Code:
pm = ondemand
pm.max_children = 5
pm.max_spare_servers = 1
pm.min_spare_servers = 1
pm.process_idle_timeout = 10s
pm.start_servers = 1
This example work fine for any website with low/medium traffic.

For websites with more traffic, I use the following configuration :
Code:
pm = ondemand
pm.max_children = 100
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 30
pm.process_idle_timeout = 10s
pm.max_requests = 500
 

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
djsmiley2k
Do I need to use all to apply for high traffic sites? or there is a configuration in this will determine for website with more traffic? maybe this pm.max_requests = 500?
 

VirtuBox

Well-known member
Registered
Joined
May 3, 2016
Messages
1,622
Points
83
For high traffic website, I just set a higher amount of child process in my php-fpm configuration.
The directive pm.max_requests = 500 only set the number of requests each child process should execute before respawning, it's an useful directive to avoid high-memory usage in case of memory leak with php applications.
 
Older Threads
Replies
3
Views
2,250
Replies
16
Views
5,120
Replies
1
Views
1,586
Newer Threads
Replies
3
Views
2,501
Replies
8
Views
3,686
Replies
4
Views
2,672
Recommended Threads
Replies
1
Views
2,221
Replies
6
Views
2,548
Replies
0
Views
1,334
Replies
9
Views
6,132

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top