perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Heffner <iheff...@gmail.com>
Subject Re: mod_perl2 with mod_dbd and Apache2
Date Wed, 11 Feb 2009 16:19:38 GMT
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-dev@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
>
>

Mime
View raw message