[FASTCGI] fastcgi opening pages - very slow
Olivier Le Cam
Olivier.LeCam at crdp.ac-versailles.fr
Tue Apr 21 02:54:57 EDT 2009
root at menkisys.net wrote:
> i have debian lenny 64bit lenny server with intel quadcore cpu and 4gb
> ram (fastcgi 2.4.6). i have about 1.4 tb traffic month on this server.
> my problem is the speed of fastcgi applikation. when i want the visit
> one website on my server somethimes i must wait about 5 seconds the view
> the site. after them the speed is better. you can try the visit these
> sites and you will see somethimes you must wait some seconds the view
> the site:
> http://www.ally-tera.de or http://www.board2null.de . when i restart the
> webserver everything ist going very fast for 30 minutes. after them the
> speed ist very bad again. please help me to solve the problem. is my
> configuration bad? i have many visitors per day: about 5000....
I reported something similar before (see below) but I never get rid of
A far as I understood, fastcgi always tries to connect to a php-cgi
process even if that said-process is no longer loaded (aka was killed by
fastcgi). In this situation, fastcgi keep tries to join a non-existing
process until timeout is reached. After that only it does respawn a new
process which takes several seconds indeed due to the timeout. I think
that when a previously-spawned process is killed for some reasons,
fastcgi should not leave any trace of it in order to respawn a new one
as soon as possible when required. I started to deal with that problem
but I never find enough time to spend entering my brain in the source code!
I'm not sure that I helped you so much, except that now you know you are
not alone to face this problem! :)
Olivier Le Cam
-- Copy of email sent on Nov 11, 2008 --
Setup based on Apache (2.2.3-4+etch5) + libapache2-mod-fastcgi (2.4.2-8)
+ php5-cgi (5.2.6-0.dotdeb.1)
Everything is working fine with this setup except for an abnormal long
delay for spawning a new php5-cgi through suexec for the second time
(after the first one has been killed).
Way to repeat the problem:
1. Apache just (re)started
2. Access to a virtualhost, say http://test.mydomain.com
This takes approx. 0.5s which is fine
2. Access to this site again
This takes approx. 0.04s which is still fine
3. Wait that the spawned process php5-cgi for this virtualhost is killed
by fcgi-pm. Then access to the site again. Now it takes more than 3s to
get the php5-cgi spawned. After that, time access is back to normal
(~0.04s) untill the process is killed (then the 3s delay come back for
the next spawn).
I have this in my Apache conf:
FastCgiConfig -minProcesses 0 -maxClassProcesses 1 -maxProcesses 300 \
-processSlack 30 -singleThreshold 20 -killInterval 240
AddHandler php5-fastcgi .php .php3 .php4 .php5
Action php5-fastcgi /cgi-bin/php5-fcgi
AddType application/x-httpd-php .php5
And this is the cgi-bin/php5-fcgi wrapper:
I spends some time attaching strace to fcgi-pm and Apache process, but I
sadly didn't get a chance to figure out what could be the problem.
Does this sound to someone?
Any help/hint/idea will be greatly appreciated. Thanks in anticipation!
More information about the FastCGI-developers