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

 ID:                 52569
 Comment by:         dbetz at df dot eu
 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:

If i can help you with debug informations, pls tell me what information you 
need.
eg traces or gdb ?

Greetings,


Previous Comments:
------------------------------------------------------------------------
[2011-07-07 02:34:46] dbetz at df dot eu

Hello,

i know, but when i make an request, no child gets spawned.

My PHP-FPM has more pools. Every pool is listening to an different socket.
The mod_fastcgi 2.4.6 is patched, that it connects to the socket for the domain.

Example:

Hostname: www.domain.com has PHP Version 5.3.6

FPM Config for Pool is:
[domain.com]
listen = /etc/httpd/fastcgi/5.3.6-domain.com
user = u12345
group = nobody

pm = ondemand
pm.process_idle_timeout = 10
pm.min_delay_between_fork = 10000
pm.max_children = 5

When now an request for www.domain.com to the apache arrives, the apache looks 
in the ldap for the PHP Version, then mod_fastcgi searches for socket 
/etc/httpd/fastcgi/5.3.6-www.domain.com, if not existent for 
/etc/httpd/fastcgi/5.3.6-domain.com (snips www. ). Now Apache connects over 
mod_fastcgi to the correct socket, but no child gets spawned with pm = ondemand

With dynamic and static all works fine.

Any suggestions ?

Greetings,
Daniel

------------------------------------------------------------------------
[2011-07-06 12:12:34] f...@php.net

This is normal.

the ONDEMAND pm has been made to avoid forking unnecessary children. Children 
are forked when requests arrives.

Here is what I have on my side:

## conf: 
pm = ondemand
pm.process_idle_timeout = 10
pm.min_delay_between_fork = 10000 # this to avoid the known bug
pm.max_children = 5


## log
[06-Jul-2011 18:05:42.236929] NOTICE: pid 2579, fpm_event_loop(), line 267: 
ready to handle connections
[06-Jul-2011 18:05:43.237287] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children

## at start, no children have been forked
[06-Jul-2011 18:05:44.237661] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children

## I request a page and a child is forked to serve the page
[06-Jul-2011 18:05:44.902976] DEBUG: pid 2579, fpm_children_make(), line 411: 
[pool direct] child 2580 started
[06-Jul-2011 18:05:44.902987] DEBUG: pid 2579, fpm_pctl_on_socket_accept(), 
line 543: [pool direct] got accept without idle child available .... I forked, 
now=1970813.831429
[06-Jul-2011 18:05:45.238081] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:46.238388] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:47.238889] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:48.239385] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:49.239671] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:50.240080] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:51.240520] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:52.241133] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:53.241648] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:54.242040] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:55.242414] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children

## 10s (pm.process_idle_timeout) later, the child has been killed.
[06-Jul-2011 18:05:55.243492] DEBUG: pid 2579, fpm_got_signal(), line 76: 
received SIGCHLD
[06-Jul-2011 18:05:55.243514] DEBUG: pid 2579, fpm_children_bury(), line 254: 
[pool direct] child 2580 has been killed by the process managment after 
10.340552 seconds from start
[06-Jul-2011 18:05:56.242905] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children
[06-Jul-2011 18:05:57.243332] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children

------------------------------------------------------------------------
[2011-07-06 10:44:25] dbetz at df dot eu

Hi Jerome,

what config options must i have in php-fpm.conf to get this working ?
I have tried following:
pm = ondemand

pm.min_spare_servers = 1
pm.max_children = 2000
pm.process_idle_timeout = 10s
pm.min_delay_between_fork = 100


but no child starts for this pool:
[06-Jul-2011 16:32:31.031068] DEBUG: pid 3417, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool default] currently 
0 active children, 0 spare children
[06-Jul-2011 16:32:32.031349] DEBUG: pid 3417, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool default] currently 
0 active children, 0 spare children


greets,
daniel

------------------------------------------------------------------------
[2011-07-05 19:15:08] f...@php.net

I've upload 2 new versions of the patch for the ondemand PM:

1- fpm-ondemand.v7.patch applies to 5.4 SVN branch and trunk
2- fpm-ondemand.v7-5.3.patch applies to 5.3 SVN branch

it works except that the event is triggered more than once when a request is 
coming. This makes the ondemand PM to fork more than it should do.

I'll look into that but if you have an idea, don't keep it for yourself.

Can you please test it ?

thx
++ jerome

------------------------------------------------------------------------
[2011-07-05 19:12:10] f...@php.net

The following patch has been added/updated:

Patch Name: fpm-ondemand.v7-5.3.patch
Revision:   1309907530
URL:        
https://bugs.php.net/patch-display.php?bug=52569&patch=fpm-ondemand.v7-5.3.patch&revision=1309907530

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


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