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
3,740
Replies
16
Views
8,234
Replies
1
Views
3,101
Newer Threads
Replies
3
Views
3,736
Replies
8
Views
5,881
Replies
4
Views
3,953
Latest Threads
Replies
2
Views
204
Replies
1
Views
993
Replies
2
Views
748
Recommended Threads
Replies
30
Views
14,318
Replies
39
Views
16,075
Replies
5
Views
4,609
Replies
8
Views
4,199

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