[cgiapp] cached DBI connections with cgiapp/fastcgi

Ron Savage ron at savage.net.au
Thu Oct 23 21:44:09 EDT 2008


Hi Ben

Thanx for the detail.

> So, what is not mentioned is that I am converting, or rather  
> RECONVERTING a large
> app (well the whole thing is 120 or so CGIs, I think we converted only  
> 20-25) that used old vanilla CGI to CGI::Application.

Yes, I can see how that would be a pain.

> This was done long before I was aware of C::A::Dispatch.  This works,  
> it's just too slow (for various reasons).

Do you mean the conversion process is too slow or that C::A::Dispatch is
too slow?

The former, surely.

> So I am just now trying to patch this to run under fcgi, because from  
> my poking around this would require
> less rewriting of the code I already have (vis-a-vis mod_perl).

Another approach is to clean up any usage of global variables, and to
then run them all as registry scripts (mod_perl on-the-cheap, so to
speak).

> I suppose what I will do is mess around with FCGI for another day or  
> so, and then go down the mod_perl route.
> 
> 
> Oh, and UPDATE, after the user goes IDLE $dbh->ping FAILS but  
> C:A:P:DBH blows through this somehow and doesn't reconnect.
> 
> This command (again Config::DB is just a wrapper)
> 
> perl -I ./lib -MConfig::DB -e '$d=Config::DB- 
>  >dbh_cached('tester','test4sdev2'); $q="select count(*) from  
> bud.feature";$d->ping;$ss=$d->selectall_arrayref($q);print $ss->[0] 
> [0],"\n";sleep(910);$d=Config::DB->dbh_cached('tester','test4sdev2')  
> unless $d->ping;$s=$d->selectall_arrayref($q);print $s->[0][0],"\n"'
> 
> works (note 910 is > the IDLE time).  But fails you don't explicitly  
> reconnect when ping fails.  Which is, I think what C:A:P:DBH is  
> supposed to do, but doesn't.  Now writing tests...

Never used it, can't say.

-- 
Ron Savage
ron at savage.net.au
http://savage.net.au/index.html




More information about the cgiapp mailing list