You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Brian Leech <bc...@po.cwru.edu> on 2000/07/11 00:54:30 UTC

Persistent database connections

I'm using Apache::DBI to maintain persistent db connections using 
mod_perl.  To test this, I'm using a simple script like:

use strict;
print "Content-type: text/html\n\n";
print DBI->connect( ...same connect args as connect_on_init... );

Everytime I reload the script, I get the same hash reference (it has the 
same address).  I turned on DEBUG for Apache::DBI, and the requests are 
definitely being served by different children, so shouldn't each one have 
its own database handle?

Thanks,
Brian


Re: Persistent database connections

Posted by Richard Dice <rd...@pobox.com>.
> Everytime I reload the script, I get the same hash reference (it has the
> same address).  I turned on DEBUG for Apache::DBI, and the requests are
> definitely being served by different children, so shouldn't each one have
> its own database handle?

Yes.

The speed gains of persistent database connections won't entirely be
realized until you've "saturated" your pool of Apache children, achieving
a steady-state where all your children have a cached persistent database
connection.

Cheers,
Richard

-- 
----------------------------------------------------------------------------
 Richard Dice * Personal 514 816 9568 * Fax 514 816 9569
 ShadNet Creator * http://shadnet.shad.ca/ * rdice@shadnet.shad.ca
 Occasional Writer, HotWired * http://www.hotwired.com/webmonkey/
     "squeeze the world 'til it's small enough to join us heel to toe"
         - jesus jones