There's a web application that I developed at work which runs under the
Catalyst MVC framework for Perl.
Catalyst is fun to develop in, but this particular application has a lot of
code and made for very large Apache server processes. The result was a lot of
swapping on the server and really slow shutdown times for the Apache
process. I decided to migrate the application to FastCGI. Finding all the
configuration details was a bit of a pain, but the final steps are simple.
I've restated those steps here to save you (and me) some time.
Migrate to CGI
I found it easiest to make sure the Catalyst application was running under CGI
without trouble before beginning the FastCGI portion. It also helped me to
create an empty Catalyst application to make sure none of my code was
responsible for failure.
> catalyst TestApp
In your httpd.conf
file, add directives like this
(assuming you have mod_cgi already installed and loaded).
Alias /testapp/ /absolute/path/to/TestApp/script/testapp_cgi.pl/
<Location /testapp/>
SetHandler cgi-script
Options +ExecCGI
</Location>
Now you can visit http://server/testapp/ to see the default Catalyst
screen.
Migrate to FastCGI
Once that's working, move the app over to FastCGI. You'll need to install
mod_fastcgi (available from
FastCGI's webpage) or install
mod_fcgid (a compatible
alternative). Now change your Apache directives to the following:
Alias /testapp/ /absolute/path/to/TestApp/script/testapp_fastcgi.pl/
<Location /testapp/>
SetHandler fastcgi-script
Options +ExecCGI
</Location>
The only changes in the above configuration are to add fast
totestapp_cgi.pl
and cgi-script
. Once
that works, you can replace the TestApp locations and names with the
ones for your real application.
Some documentation online mentioned using Apache's Action
directive. I wasn't able to make that work, but Alias
seems to do the trick.
No comments:
Post a Comment