logo       

Configure the number of processes: msg#00014

web.fastcgi.devel

Subject: Configure the number of processes

Hello,

I'm running Apache 2.0 with FastCGI and PHP 5.2 on Linux. Apache is
serving various virtual hosts for several clients, of which each has
their own user name. All PHP requests are processed through suexec in
their correct accounts.

Now there is a little problem with the number of processes. When I
restart Apache, there is no PHP-fcgi process. When I access a web page,
one is created for that virtual host. And it is reused for every further
request to that virtual host (i.e. subdomain).

I was trying to get the file upload tracking thing running in PHP, with
the APC extension. APC works fine, but it can only report upload
progress when the process handling the upload is the same handling the
progress request. But when I start an upload, many other PHP processes
are created, this can be up to 10, which are then handling all requests
to this subdomain in a round-robin fashion. By the time, after some
minutes, I have the impression that the number of active processes
decreases, until only a single process is handling requests again.

What I want is to decrease the number of processes per subdomain to one,
or maybe 2 or 3 only. Using the -maxProcesses option to the
FastCgiConfig option seems to limit the number of PHP processes for the
entire server, which is not acceptable. I haven't found a way to do what
I mean.

Is there a way to do this?

Another related question: Does that make sense at all? Won't a file
upload block a PHP process until the upload is finished? At least I had
this impression in my tests. If this is true, APC upload tracking would
be rather senseless and I'd head over to them for a bug report. I'm not
sure where the actual problem lies.

Here's parts of my configuration:

--- httpd.conf
LoadModule fastcgi_module modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiWrapper bin/suexec
FastCgiConfig -idle-timeout 300 -listen-queue-depth 512
-singleThreshold 0 -pass-header HTTP_AUTHORIZATION
Action application/x-httpd-php5 /cgi-bin/php5.fcgi
</IfModule>

# Virtual Host:
<IfModule mod_fastcgi.c>
AddType application/x-httpd-php5 .php
</IfModule>
SuexecUserGroup web*** webusers
---

--- /web***/cgi-bin/php5.fcgi
#!/bin/sh
#export PHP_FCGI_CHILDREN=3
exec /usr/local/bin/php5-fcgi
---

The PHP_FCGI_CHILDREN option makes each PHP process opened by FastCGI
start constantly (not on-demand) n more processes on its own, which
leads to too many processes.

Checking what process is handling a request can be done with the PHP script:

<?php
echo getmypid();
?>

(I made a more comfortable version that remembers all PIDs in a session
array, with count and clear option.)

--
Yves Goergen "LonelyPixel" <nospam.list-nqjHM+VR3sucZijExnzlNg@xxxxxxxxxxxxxxxx>
Visit my web laboratory at http://beta.unclassified.de

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise