SpeedyCGI


Warning: These wiki pages have not been edited in years and may well be out of date/inaccurate. We recommend that you use them as a starting point for further investigation, rather than gospel.
You can learn about SpeedyCGI from its [homepage http://daemoninc.com/SpeedyCGI/]. A quick comparison between SpeedyCGI, FastCGI, and mod_perl can be found in [this http://daemoninc.com/speedy/oldmailArchive/msg00113.html] mailing list posting.

From the homepage:

"SpeedyCGI is a way to run perl scripts persistently, which can make them run much more quickly. A script can be made to to run persistently by changing the interpreter line at the top of the script from:

#!/usr/bin/perl

to

#!/usr/bin/speedy

After the script is initially run, instead of exiting, the perl interpreter is kept running. During subsequent runs, this interpreter is used to handle new executions instead of starting a new perl interpreter each time. A very fast frontend program, written in C, is executed for each request. This fast frontend then contacts the persistent Perl process, which is usually already running, to do the work and return the results."

*Apache Configuration:*

Action html-mason /cgi-bin/mason_handler.pl
AddHandler html-mason .html

Or equivilantly:

Action html-mason /cgi-bin/mason_handler.pl
<LocationMatch "\.html$">
SetHandler html-mason
</LocationMatch>

*mason_handler.pl:*

#!/usr/bin/speedy
use HTML::Mason::CGIHandler;

my $h = HTML::Mason::CGIHandler->new(
data_dir => '/var/cache/mason'
);

$h->handle_request;

*Alternatives*

FastCGI