FastCGI + PHP + APC on Apache2 - Concurrency issues

"Renaud Drousies" <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hello,

I am not sure this is actually a FastCGI, Apache2 or PHP configuration
issue, but here is my problem:

I have the current configuration in my apache2:

Alias /cgi-bin/ /www/cgi-bin/
FastCgiServer /www/cgi-bin/php-fcgi -processes 1 -idle-timeout 180 -socket
/tmp/fastcgi.socket
AddType application/x-httpd-fastphp .php
Action application/x-httpd-fastphp /cgi-bin/php-fcgi

And that wrapper:

#!/bin/sh
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=500
export PHP_FCGI_MAX_REQUESTS
exec /usr/local/bin/php


When I start apache, this gives me the correct number of processes:

www-data  3422  3421  0 04:59 ?        00:00:00  \_ /usr/sbin/fcgi-pm -k
start -DSSL
www-data  3423  3422  0 04:59 ?        00:00:00  |   \_ /usr/local/bin/php
www-data  3424  3423  0 04:59 ?        00:00:00  |       \_
/usr/local/bin/php
www-data  3425  3423  0 04:59 ?        00:00:00  |       \_
/usr/local/bin/php
www-data  3426  3423  0 04:59 ?        00:00:00  |       \_
/usr/local/bin/php
www-data  3427  3423  0 04:59 ?        00:00:00  |       \_
/usr/local/bin/php
www-data  3428  3421  0 04:59 ?        00:00:00  \_ /usr/sbin/apache2 -k
start -DSSL
www-data  3429  3421  0 04:59 ?        00:00:00  \_ /usr/sbin/apache2 -k
start -DSSL
www-data  3430  3421  0 04:59 ?        00:00:00  \_ /usr/sbin/apache2 -k
start -DSSL
www-data  3431  3421  0 04:59 ?        00:00:00  \_ /usr/sbin/apache2 -k
start -DSSL
www-data  3432  3421  0 04:59 ?        00:00:00  \_ /usr/sbin/apache2 -k
start -DSSL
www-data  3434  3421  0 04:59 ?        00:00:00  \_ /usr/sbin/apache2 -k
start -DSSL


I am using only 1 FastCgiServer process because it is required to benefit
from the APC cache between the different php handlers. The problem is that
I cannot seem to handle more than 1 php request at a time.

This is a script I am using to test that:

print date("Y-m-d H:i:s"); print "<br />";
sleep(10);
print date("Y-m-d H:i:s"); print "<br />";

If I request that script 3 times, within the same second, it returns me:

2006-10-17 05:02:35
2006-10-17 05:02:45

2006-10-17 05:02:45
2006-10-17 05:02:55

2006-10-17 05:02:55
2006-10-17 05:03:05

It waits for the previous script to be done to start the next request. Am
I doing something wrong in my configuration? I would expect my server to
be able to handle more thant 1 request at a time :-)

Actually this acts the same if I increase the FastCgiServer's -process...

Thanks!

Regards,
Renaud



___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.