Filip Hajny a écrit :
> Yes, well, my point was... if you care about shared memory, then  
> constrain mod_fcgid to a single PHP process only, let the PHP process  
> fork its own children and hope they will be able to process all  
> requests before mod_fcgid considers the single process busy and you  
> end up getting 503.
>   
My english is not really good, so maybe I very badly explained my 
original problem, but all the problem is here : letting PHP do that 
doesn't work at all.

I use this configuration for mod_fcgid :
DefaultMaxClassProcessCount 1
DefaultMinClassProcessCount 1

And in the PHP wrapper :
export PHP_FCGI_CHILDREN=8


So I obtain this php5-cgi processes :

init(1)─┬─apache2(1591)─┬─apache2(22940)───php5-cgi(23015)─┬─php5-cgi(23017)
│ │ ├─php5-cgi(23018)
│ │ ├─php5-cgi(23019)
│ │ ├─php5-cgi(23020)
│ │ ├─php5-cgi(23021)
│ │ ├─php5-cgi(23022)
│ │ ├─php5-cgi(23023)
│ │ └─php5-cgi(23024)


I test with that PHP script :
<?php
sleep(5);
echo 'OK';
?>

Then I launch 4 concurrent access though that script :
#!/bin/sh
wget http://localhost/test.php -q -O test1.log &
wget http://localhost/test.php -q -O test2.log &
wget http://localhost/test.php -q -O test3.log &
wget http://localhost/test.php -q -O test4.log &
wait

Then : time ./test.sh
 > scrubby:~# time ./check
 >
 > real 0m21.012s
 > user 0m0.004s
 > sys 0m0.012s


Or also : ab -c 4 -n 4 http://localhost/test.php
 > Concurrency Level: 4
 > Time taken for tests: 22.2176 seconds
 > Complete requests: 4
 > Failed requests: 0
 > Write errors: 0
 > Total transferred: 684 bytes
 > HTML transferred: 8 bytes
 > Requests per second: 0.18 [#/sec] (mean)
 > Time per request: 22002.176 [ms] (mean)
 > Time per request: 5500.544 [ms] (mean, across all concurrent requests)


The benchmark should past 5 seconds per page, no ? The php forks are not 
usefull with mod_fgid, or my setup have a serious problem.


Of course, if I remove PHP_FCGI_CHILDREN and increase 
DefaultMaxClassProcessCount, this works very well but loose all the 
shared memory stuff (APC, Xcache, etc) :

 > scrubby:~# time ./check
 >
 > real 0m5.008s
 > user 0m0.004s
 > sys 0m0.004s

Olivier

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Mod-fcgid-users mailing list
Mod-fcgid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-fcgid-users

Reply via email to