0

I've a Plesk 9.5.4 server on Debian with PHP 5.2.6-1+lenny13, which keeps its php5-cgi process continuously active. I edited the /etc/apache2/conf.d/fcgid.conf and changed the values (and checked if the config was loaded anyway, which was true).

IdleTimeout 500
ProcessLifeTime 360

But still the process keeps alive for over an hour, and there is no activity for longer than half a hour.

Anyone knows what the problem can be?

2 Answers 2

0

CGI process are kept "alive" so they can handle requests immediately. They do not terminate after a single request, but are often configured to handle 500-5000 requests until they get replaced with a new one.

The relevant config options are

PHP_FCGI_CHILDREN=60
PHP_FCGI_MAX_REQUESTS=5000

CGI process management

The web server does not care care itself about handling 50+ PHP-CGI instances that may handle requests, but leaves this job to the CGI server. The CGI server itself keeps a pool of PHP-CGI instances running. It also kills them when they are not needed anymore and starts them when required.

CGI server configuration

IdleTimeout

tells the CGI process manager how long to wait for the CGI process to return a response.

Example:

The web server gets a HTTP request, sends that to the CGI server, CGI server relays that to the PHP-CGI process. Now the PHP-CGI process computes and computes and takes 1 minute to finish. Since the timeout is 120, everything is fine.

Now another request comes in, and the computation is harder, and the PHP-CGI process takes 10 minutes to finish. After 2 minutes, the CGI server reaches the CGI process' idle timeout and decides not to wait any longer. It returns an error to the HTTP server: "no data retrieved, idle timeout".

ProcessLifetime

is the number of seconds that a CGI process may be kept running. After that it's replaced with a new one.

3
  • Used this in the config : IdleTimeout 500 ProcessLifeTime 360, so normaly they would be killed after 360 seconds Aug 19, 2011 at 13:10
  • Yes, this is clear, but the process isn't be replaced, but the process remains for days and longer. Aug 19, 2011 at 14:22
  • @Martijn it's probably because of the other settings I mentioned which keep a minimum number of processes around regardless of timeouts. Aug 19, 2011 at 14:47
0

mod_fastcgi

Check your setting for

-minProcesses n (5) The minimum total number of dynamic FastCGI application instances allowed to run at any one time without being killed off by the process manager (due to lack of demand).

It defaults to 5.

mod_fcgid

Check your setting for

FcgidMinProcessesPerClass

This directive sets the minimum number of processes that will be retained in a process class after finishing requests.

This setting will apply to all applications spawned for this server or virtual host. Use FcgidCmdOptions to apply this setting to a single application.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .