[cgiapp] cached DBI connections with cgiapp/fastcgi
Benjamin Hitz
hitz at genome.stanford.edu
Thu Oct 23 19:39:09 EDT 2008
> I'm confused.
Hey, join the club.
>
>
> If you use Apache::DBI then what's the point of using
> CGI::Application::Plugin::DBH?
No, I wasn't USING it - ASFAIK, Apache::DBI only works with mod_perl.
I was just looking at the code to see how it handled persistant
connections.
>
>
> And at the same time, why use FastCGI? I tried it, and it worked for
> sure, but I prefer to use CGI::Application::Dispatch, with the latter
> wearing its 'mod_perl handler' hat.
>
> If you are in a position to compile Apache and mod_perl, then mod_perl
> via C::A::Dispatch is surely the way to go.
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.
This was done long before I was aware of C::A::Dispatch. This works,
it's just too slow (for various reasons).
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).
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...
Thanks again,
Ben
--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO
Consortium
Stanford University ** hitz at genome.stanford.edu
More information about the cgiapp
mailing list