FastCGI and Apache Problems

Stanley Gambarin (gambarin@OpenMarket.com)
Wed, 19 Mar 1997 12:47:44 -0500

Message-Id: <199703191747.MAA01785@u4-138.openmarket.com>
To: Graham Potts <graham@pncl.co.uk>
In-Reply-To: Your message of "Mon, 17 Mar 1997 08:13:18 GMT."
             <1.5.4.32.19970317081318.006fe548@pncl.co.uk> 
Date: Wed, 19 Mar 1997 12:47:44 -0500
From: Stanley Gambarin <gambarin@OpenMarket.com>
Subject: FastCGI and Apache Problems

> The site has been up and running since saturday and we now have a problem
> which appears periodically. One or two of the more heavily used fastcgi
> processes fails after about an hour of running. A 500 error is returned to
> the web browser and the Apache error log shows errors to the effect that the
> connections to the fastcgi process have been refused.
> 
	I can see two potential problems that may be the cause of the
misbehavior above.  The first problem is possible if the fastcgi application
or the server misbehave and keep the connection open between then.  In that
case, after all the connections have been exhausted, the web server will be
unable to connect to any instance of the FCGI app.  If that is the problem, 
then the solution would involve tracing the execution and determining the
point which causes the delay in terminating the connection.
	The second problem could occur during the spike of the requests to
the same fastcgi app.  If you have configured fastcgi app to spawn n instances
of itself, it will not be able to process more than n requests for that 
fastcgi application at any one time.  The solution in this case would involve
increasing the number of spawned processes, using -processes option in 
the AppClass directive.  
	Finally, it is very important to note that if your fastcgi applications
take a long time to execute (by long time I mean 10+ secs), the savings 
provided
by fastcgi in saving fork/exec calls become negligible compared to the time it
takes to service the request and so you may resort to CGI for easy of usage.
					Hope that was of some help.
								Stanley.