Edit report at https://bugs.php.net/bug.php?id=52569&edit=1

 ID:                 52569
 Comment by:         f...@php.net
 Reported by:        mplomer at gmx dot de
 Summary:            Implement "ondemand" process-manager (to allow zero
                     children)
 Status:             Analyzed
 Type:               Feature/Change Request
 Package:            FPM related
 PHP Version:        5.3.3
 Assigned To:        fat
 Block user comment: N
 Private report:     N

 New Comment:

To sum up the patch:

1- new configuration:
 * in globals: events.delay (default 500µs). It's the delay between 2 triggers 
on a FD event. You can disable the delay by setting it to 0. You should change 
it when the ondemand PM 
forks more child than it should do.

 * in pools: pm = "ondemand" to active the ondemand PM. In this mode, no 
processes are forked at startup but when requests are comming

 * in pools: pm.process_idle_timeout the time a process should stay idle 
without serving any requests before it's killed

2- Here is the debug log I have when setting log_level to debug, error_log to 
/dev/stderr and daemonize to no:

[10-Jul-2011 18:58:14.207987] DEBUG: pid 11370, fpm_scoreboard_init_main(), 
line 40: got clock tick '100'
[10-Jul-2011 18:58:14.208169] DEBUG: pid 11370, fpm_event_init_main(), line 
239: 11 fds have been reserved
[10-Jul-2011 18:58:14.208177] NOTICE: pid 11370, fpm_init(), line 77: fpm is 
running, pid 11370
[10-Jul-2011 18:58:14.208189] DEBUG: pid 11370, fpm_event_loop(), line 266: 
5984 bytes have been reserved in SHM
[10-Jul-2011 18:58:14.208194] DEBUG: pid 11370, fpm_event_loop(), line 267: 
events.delay = 500
[10-Jul-2011 18:58:14.208197] NOTICE: pid 11370, fpm_event_loop(), line 268: 
ready to handle connections
[10-Jul-2011 18:58:15.208565] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children
[10-Jul-2011 18:58:16.208945] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children
[10-Jul-2011 18:58:16.778599] DEBUG: pid 11370, fpm_children_make(), line 411: 
[pool direct] child 11371 started
[10-Jul-2011 18:58:16.778615] DEBUG: pid 11370, fpm_pctl_on_socket_accept(), 
line 532: [pool direct] got accept without idle child available .... I forked
[10-Jul-2011 18:58:17.209294] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:18.209631] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:19.210035] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:20.210382] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:21.210751] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:22.211264] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:23.211732] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:24.212057] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:25.212462] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:26.212763] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:27.213155] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[10-Jul-2011 18:58:27.221542] DEBUG: pid 11370, fpm_got_signal(), line 76: 
received SIGCHLD
[10-Jul-2011 18:58:27.221575] DEBUG: pid 11370, fpm_children_bury(), line 254: 
[pool direct] child 11371 has been killed by the process managment after 
10.442991 seconds from start
[10-Jul-2011 18:58:28.214082] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children
[10-Jul-2011 18:58:29.214542] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children
[10-Jul-2011 18:58:30.214972] DEBUG: pid 11370, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children


Previous Comments:
------------------------------------------------------------------------
[2011-07-10 12:32:11] trollofdarkness at gmail dot com

Hello,

Ok so it is normal.

I think it would be great to make a short sum up of what's been introduced in 
the FPM configuration by this patch, and what behaviour of what already 
existing config directive has been modified. I read the entire bug file, but 
did not completely understand what's been modified / introduced about the 
config directives.

To answer your question I am running Debian Lenny 64bits. PHP has been compiled 
successfully from the last SVN sources (5.3 branch). And as I said, I used both 
Apache2 and Nginx, I tried with both sockets and host:ip methods and is has 
exactly the same behaviour with the two methods :

When FPM starts, no process is launched for the given pool (ok, that's right)
When a request comes... the web server handles it, passes it to FPM ... But 
after, I don't know, I did not see anything shocking in the log file... And 
absolutly no process is started by FPM. So the request waits until the 
webserver finally decides that FPM is not responding correctly and displays an 
error message instead (after at least 1 minute, so that's not about FPM being 
slow or something like that).


Thanks in advance.

Troll

------------------------------------------------------------------------
[2011-07-10 11:02:38] f...@php.net

pm.min_delay_between_fork has been removed since the version 9 of the patch. 
This 
is normal :)

which OS/version are you using ?

------------------------------------------------------------------------
[2011-07-09 11:47:29] trollofdarkness at gmail dot com

I think I get the same problem as dbetz .

I am using sockets (one per website) with both Apache2 and Nginx. Neither with 
the first nor the second it worked.

I tried with the use of ip:port instead of sockets but it is exactly the 
same... 

I've no idea where it comes from.

------------------------------------------------------------------------
[2011-07-09 11:08:15] trollofdarkness at gmail dot com

Hello everyone,

I tried patching the last 5.3 SVN branch with the patch. All went well (config, 
compile, etc. ...). But after restarting php-fpm I get that : 

Starting php-fpm [09-Jul-2011 16:57:37] ERROR: [/usr/local/etc/php-fpm.conf:27] 
unknown entry 'pm.min_delay_between_fork' 


Which is pretty strange because the other options are not showing any error :

This works :
[mypool]
pm = ondemand
pm.process_idle_timeout = 10
# plus the other config lines...

But this, will show the previous error message :

[mypool]
pm = ondemand
pm.process_idle_timeout = 10
pm.min_delay_between_fork = 10000 # this to avoid the known bug
# plus the other config lines...

Any idea ?

Else, beside that, if I use the pm = ondemand , there is absolutly no process 
forked. Neither at the beginning, nor after, when a request comes... 
However, pm=dynamic & pm=static still works well... ??

------------------------------------------------------------------------
[2011-07-09 08:33:10] f...@php.net

Here is a new release of the patch which is supposed to correct the double fork 
bug.

I've moved pm.min_delay_between_fork to the event layer and it's now defined in 
the global section as events.delay (default 500µs)

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=52569


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=52569&edit=1

Reply via email to