PM on demand vs Dynamic?

djsmiley2k

Well-known member
Joined
Jul 10, 2016
Messages
154
Best answers
1
Ratings
8
Points
18
#1
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

Global Mod
Staff Member
Joined
May 3, 2016
Messages
1,551
Best answers
4
Ratings
412 13
Points
83
#2
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
Joined
Jul 10, 2016
Messages
154
Best answers
1
Ratings
8
Points
18
#3
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

Global Mod
Staff Member
Joined
May 3, 2016
Messages
1,551
Best answers
4
Ratings
412 13
Points
83
#4
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
Joined
Jul 10, 2016
Messages
154
Best answers
1
Ratings
8
Points
18
#5
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

Global Mod
Staff Member
Joined
May 3, 2016
Messages
1,551
Best answers
4
Ratings
412 13
Points
83
#6
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
270
Replies
16
Views
816
Replies
1
Views
227
Newer Threads
Replies
3
Views
528
Replies
8
Views
597
Replies
4
Views
589
Latest Threads
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

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