You'd probably want to use Apache::DBI in that case.

I got the impression that you were maybe running under a
threaded model with many children serving static content but
sometimes opening DBI connections.

Connection pooling is a cool idea but I don't know who's
made it work.  For example, `man DBI` says:

"Why would you want to do this? You don't, forget I even
mentioned it. Unless, that is, you're implementing something
advanced like a multi-threaded connection pool. See
DBI::Pool."

But DBI::Pool doesn't appear to be on CPAN.

Probably what you want to do is to factor the parts of your
application that require the database onto a separate
server with a different URL, that way you can manage them.

Mark

On Wed, 11 Feb 2009, Ivan Heffner wrote:

> I realize that this response is months late, but this thread is only
> now coming to my attention due to another recent response. Still, I
> think you may have been trying to solve the wrong problem. Perhaps I'm
> missing a detail or two here, but you are running mod_perl. Perl
> processes live on beyond the time to service one request. Why don't
> you set up a PerlChildInitHandler that establishes your database
> connection and holds on to it?
>
> $dbh = DBI->connect_cached($data_source, $username, $password, \%attr)
>           or die $DBI::errstr;
>
> As long as you are not running so many severs / children that you
> saturate you DB connection limit, you should be fine.
>
> Ivan
>
> On Wed, Aug 27, 2008 at 1:15 AM, Timothy Partee <perl-...@furcen.org> wrote:
> >
> >   Quick question for the list. I've been scouring Google looking for
> > information on Connection Pooling to MySQL 5.0 in mod_perl2 on Apache2 using
> > mod_dbd or similar, and while I can find docs for configuring mod_dbd in
> > Apache2, and am quite familiar with mod_perl development, I'm unable to find
> > specific examples online for how to code mod_perl to access mod_dbd
> > connection pools via APR... Am I completely on the wrong track? Is there
> > another more simple way to implement MySQL DBI connection pooling in
> > mod_perl?
> >   I'm running a website that is starting to get enough traffic that opening
> > a fresh DB connection via Perl's DBI libs on each request is starting to
> > cost me serious time in serving mod_perl pages through Apache2, and I'd like
> > to implement connection pooling to improve performance. Any suggestions or
> > URLs that could help me get on the right track would be muchly appreciated!
> >
> >   Thanks,
> >
> > - Tim Partee
> >
> >
>

Reply via email to