[cgiapp] how to use C::A::Dispatch with FastCGI ?

Giannis Economou geconomou at gmail.com
Sun Feb 24 05:34:44 EST 2008


Hello...

I'm using fastcgi for C::A for a long time in production installations, 
with success (with C::A::Dispatch).
Actually, the best thing for me was to use the mod_fcgid module 
(http://fastcgi.coremail.cn/) instead of the old fastcgi (www.fastcgi.com).
mod_fcgid is binary compatibility to mod_fastcgi, but I like it much more.
mod_fcgid become more popular after RoR success - it seems it become 
quite common accelerator for  ruby environments nowadays.
Installation is pretty easy. And it's working reliable for accelarating 
my C::A non-stop in production environments.

In the past (before mod_fcgid) I had several experiences with speedycgi 
(aka perperl) and C::A (with Dispatch). But I abandon this, because 
there were problems. It was 2006 and I don't remember exactly the 
problems I had. I remember that I've managed to have speedycgi running 
and it seemed ok.
But the processes of speedycgi was becoming problematic after some 
days/weeks of execution. Maybe it had to do with database persistency, I 
really do not remember now. I remember also that I was very pleased to 
abandon speedy and to go to mod_fcgid.

BTW, if you are interested we offer shared hosting that is ready for 
C::A (wth mod_fcgi), in case you are interested. Our systems run CentOS 
4, 5 (and Debian, but our Debian servers are not available for shared 
hosting now).



To make a plain CGI C::A to go on Fast CGI (mod_fcgi), usually I just 
have to:
use CGI::Fast qw(:standard);
and then implement the main loop, as:
while ( my $q = new CGI::Fast ) {
...
}

I also use in the dispatch() options:
args_to_new => {
                        QUERY => $q,
                        PARAMS => {
                             '::Plugin::DBH::dbh_config' => [ sub 
{DBI->connect_cached(  
MyWebApp::Util::Config->instance->GetDbConnectionParams()  );} ],
                           },

(Util::Config->GetDbConnectionParams() just returns the connection string)

I also take care to not relyi on any relative paths in my C::A.



Best regards,
Giannis Economou


Ron Savage wrote:
> On Thu, 2008-02-21 at 09:59 +0800, Silent wrote:
>
> Hi Slient
>
>   
>> has anyone use C-A-Dispatch with FastCGI ?
>>     
>
> I had no trouble using it. I can send my code it that helps.
>   



More information about the cgiapp mailing list