Managing number of dispatch.fcgi processes?

I have a problem where when I try and access my site a dispatch.fcgi
process is started but then exits right after the page has loaded.
Requireing it to start all over agin the next time a request is made.
I’ve read about people using two or more FCGI processes to help with the
request load but how do people do this?

Firstly, how do you make a FCGI process persistant? I’m not sure why
mine is exiting, no errors reported in the logs.

Secondly, if you wanted to run 2 or more concurrent FCGI processes how
would you go about setting that up?

On March 4, 2006 12:28, Todd S. wrote:

would you go about setting that up?
Depends on the web server you’re using. For instance, you can set
Apache2 and
mod_fcgi to use 4 of persistent fcgi processes with a configuration like

FastCgiServer /abs/path/to/application/public/dispatch.fcgi
-idle-timeout 120
-initial-env PERL_SIGNALS=unsafe
-initial-env RAILS_ENV=production
-processes 4
You can also set it to dynamically manage its fcgi processes.

For lighttpd you can set min-procs and max-procs in your fcgi
configuration.
Look at the documentation here for more details:
http://www.lighttpd.net/documentation/fastcgi.html

For other web servers check the relevant documentation. Hope that
helps.

Luca

Well, I’m on a shared host running apache so I’m not sure how much
control I have over the configuration. They (dreamhost) and others
claim that rails works great there but I’ve not seen it work yet.

I do get these errors in my http error log…

Couldn’t write to 4: starting
TypeError: can’t convert Fixnum into String
Couldn’t write to 4: terminated gracefully
TypeError: can’t convert Fixnum into String

I’m not sure if this is the cause of the problem or not.

Couldn’t write to 4: starting
TypeError: can’t convert Fixnum into String
Couldn’t write to 4: terminated gracefully
TypeError: can’t convert Fixnum into String

These erros came from having…
RailsFCGIHandler.process! 4

in the dispatch.fcgi script as opposed to just

RailsFCGIHandler.process!

but that didn’t make the process persistant or speed up load time at
all.

Okay, I think I got it…

in my .htaccess file I had

AddHandler fastcgi-script .fcgi
AddHandler cgi-script .fcgi

if I change it to

AddHandler fastcgi-script .fcgi

AddHandler cgi-script .fcgi

then things work. Wow.