Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
9
rated 0 times [  9] [ 0]  / answers: 1 / hits: 18342  / 1 Year ago, tue, november 22, 2022, 12:20:08

I set up my nginx with php-fpm. each vhost has its own unix-socket and separate POOL.

But the problem is that php-fpm is creating 7 thread for each config pool that I created in /etc/php5/fpm/pool.d/



why? and how could I define that the pool creates only when the url related to VHOST is viewed.



enter image description here


More From » php

 Answers
0

The number of children is controlled by the process manager configuration directives in the pool configuration file. I guess the current settings are either pm = static with pm.max_children = 6 or pm = dynamic with pm.start_servers = 6. One process would be the controlling process, the others would be children ready to handle requests. If you only have 5 not 6 children configured, then I must confess I don't know what that last process is used for. On large high-throughput sites, such a configuration with many ready-to-use children makes sense, but in a memory-constrained (probably virtual) environment where you only expects PHP scripts to execute every now and then, a different configuration might be more appropriate.



To achieve this, edit the pool config files and set pm = ondemand. Then children will be created only to handle requests. This will mean less memory consumption while no requests are active, although it might also mean more time required to create a child. The latter can be reduced by choosing a reasonable pm.process_idle_timeout, so that a sane number of php processes remain idle while users can be expected to use them again soon. That “sane number” is controlled by pm.max_children.



Note: This advice is based on my experience with Debian 7, but it should apply to Ubuntu as well.


[#27907] Wednesday, November 23, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sharall

Total Points: 407
Total Questions: 127
Total Answers: 121

Location: Saint Helena
Member since Fri, Mar 26, 2021
3 Years ago
;