Re: Minimize startup timeout on dynamic fastcgi
Eugene <my-subscr-JGs/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
It seems I found the reason of slow startup! First time after apache reload startup is fast enough, but next time it's slow. I think it's due to the following reason: first time application is laucnched and socket created. [Sun Apr 02 14:22:44 2006] [notice] Apache configured -- resuming normal operations [Sun Apr 02 14:22:56 2006] [warn] FastCGI: (dynamic) server "/var/home/***/fcgi-bin/php5.fcgi" (uid 504, g id 505) started (pid 20811) After somу time of inactivity if was signalled to kill: [Sun Apr 02 14:28:02 2006] [warn] FastCGI: (dynamic) server "/var/home/***/fcgi-bin/php5.fcgi" (pid 20811) termination signaled But it was not terminated, so it got -KILL signal. [Sun Apr 02 14:28:02 2006] [warn] FastCGI: (dynamic) server "/var/home/***/fcgi-bin/php5.fcgi" (pid 20811) terminated due to uncaught signal '15' (Terminated) After some time new request arrived. Apache access_log: 82.131.0.0 - - [02/Apr/2006:14:28:25 +0400] "GET / HTTP/1.1" 200 6824 "-" "Mozilla/4.0 (compatible; MSIE 6. 0; Windows NT 5.1; SV1; MRA 4.4 (build 01334); .NET CLR 1.1.4322)" 82.131.0.0 - - [02/Apr/2006:14:28:28 +0400] "GET /style.css HTTP/1.1" 304 - "http://referer/" "Mo zilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MRA 4.4 (build 01334); .NET CLR 1.1.4322)" According to the first row, user requested main page of the site, and Apache transferred request to the fastcgi script. But it was already killed at that moment! But his socket was still alive! So mod_fascgi waited for 3 sec (as it's set by default) and then spawned new process [Sun Apr 02 14:28:28 2006] [warn] FastCGI: (dynamic) server "/var/home/***/fcgi-bin/php5.fcgi" (uid 504, g id 505) restarted (pid 20839) We may see that spawning and working was quite fast, because process was started at 14:28:28 and just at that second user had got the page, parsed it and sent new request for the stylesheet (/style.css). If I decrese -startDelay from 3 secs to 1, lag decreaes. But I don't like this solution - what if load will be very high and server will not get restarted in 1 sec? New one begins to start? I think it's a right way to overload. I guess if socket doesn't not exist mod_fastcgi will not wait for conection and begins to start application and create socket. Is it possible to delete a socket when application gets killed? I think if socket will be erased , than timeout will be completely removed. Eugene >Hi, Stefan! > > > >>What version of mod_fastcgi do you use? I recommend using: >>http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0404142202.tar.gz >> >> > >That's the version I use. > > > >>I have never had problems like this. Are you using any special >>arguments to FastCgiConfig? >>There are a number of options there that control the startup and the >>termination of the dynamic processes. >>See here: >>http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiConfig >>The only option I use is "-idle-timeout 300" because some of my >>applications take longer than the >>default timeout to come back. >> >> > >No, I use parameters like in manuals. > ><IfModule mod_fastcgi.c> > AddHandler fastcgi-script .fcgi > #FastCGISuexec /usr/sbin/suexec > FastCGISuexec /usr/local/apache2/bin/suexec > FastCgiConfig -singleThreshold 100 -killInterval 300 -autoUpdate >-idle-timeout 240 -pass-header HTTP_AUTHORIZATION > <Location /php-fastcgi/> > Options ExecCGI > SetHandler fastcgi-script > </Location> ></IfModule> > >I had looked at the manual, but didn't found a way how to minimize lag. >There's no option about this. >I'm not sure this bug relates to the timeout. >I'm using PHP 5.1.2 >Here's error log of main server >[Fri Mar 10 16:13:26 2006] [warn] FastCGI: (dynamic) server >"/var/home/user/fcgi-bin/php5.fcgi" (uid 504, gid 505) restarted (pid 18743) >[Fri Mar 10 16:18:21 2006] [warn] FastCGI: (dynamic) server >"/var/home/user/fcgi-bin/php5.fcgi" (pid 18743) termination signaled >[Fri Mar 10 16:18:21 2006] [warn] FastCGI: (dynamic) server >"/var/home/user/fcgi-bin/php5.fcgi" (pid 18743) terminated by calling >exit with status '0' >[Fri Mar 10 18:05:49 2006] [warn] FastCGI: (dynamic) server >"/var/home/user/fcgi-bin/php5.fcgi" (uid 504, gid 505) restarted (pid 19207) >Proceses start and die well AFAIK as it should be. Am I right? > >Thank you! > > > >>Make also sure you also read about the PHP FCGI bug: >>http://bugs.php.net/bug.php?id=36158 >> >>The patched version of php and SNAP-0404142202 work perfectly for me >>on a production >>server with <= 10 virtual hosts. >> >>Stefan Wendt >> >> >> >> > >___________________________________ >fastcgi-developers mailing list >http://fastcgi.com/fastcgi-developers/ > > > > ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/