mod_fcgid: can't apply process slot for /var/www/cgi-bin/cgi_wrapper/cgi_wrapper

 

This warning tells you that the FastCGI process pool is exhausted, and it has a global limit of FcgidMaxProcesses and a per-script limit of FcgidMaxProcessesPerClass (see http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidmaxprocesses).

The size of this pool may be tuned with the following information :

  • in the case where your application is CPU bound and you don't want it to slow down, you will set FcgidMaxProcesses to the number of CPU cores on your server; the server average load will tend to this number at peak hours. Your server will be serving clients without any slow down but will also reject some requests to keep up. Rejects are logged "can't apply process slot" on the server side and seen as 503 errors on the client side
  • in the (common) case where your application is not totally CPU-bound, for instance it waits a faire amount its database server for replies (or other I/O or remote ressources), you may have FcgidMaxProcesses a bit higher than your number of CPU cores. As a rule of thumb I start with twice the number of CPU cores then check the peak average load for a whole day (a week is better). Then adjust until it peaks at avg. load = number of CPU cores.

In any case the default value of FcgidMaxProcesses (1000) is outrageous. You run a dumb 'ab -c100 -n10000


Please make sure to review /etc/httpd/conf.d/fcgid.conf Below is an example of an improved configure.

# This is the Apache server configuration file for providing FastCGI support
# via mod_fcgid
#
# Documentation is available at http://fastcgi.coremail.cn/doc.htm

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule mod_fcgid.c>

<IfModule !mod_fastcgi.c>
    AddHandler fcgid-script fcg fcgi fpl
</IfModule>

  FcgidIPCDir /var/run/mod_fcgid/sock
  FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm

  FcgidIdleTimeout 40
  FcgidProcessLifeTime 30
  FcgidMaxProcesses 20
  FcgidMaxProcessesPerClass 25
  FcgidMinProcessesPerClass 0
  FcgidConnectTimeout 30
  FcgidIOTimeout 90
  FcgidInitialEnv RAILS_ENV production
  FcgidIdleScanInterval 10
MaxProcessCount 2000
 MaxRequestLen 33554432
MaxRequestsPerProcess 1000
DefaultMaxClassProcessCount 120
</IfModule>

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How to set Innodb Buffer Pool Size (MySQL)

If you need to increase the buffer pool size from the default 8MB, please add the following text...

Can't login to Plesk as admin because of > IP access restriction management

if you enable IP restriction for admin login to the plesk control panel please use see...