At 7:55 -0500 1/5/03, Chris Faust wrote:
>Due to ever increasing traffic I'm converting my site into mod_perl and
>quite honestly I'm confused about persistent DB connection and DB connection
>pooling.. I know there is tons of info out there on the goggle groups and on
>perl.apache.com, I also picked up "Mod_Perl Developers cookbook" and I also
>have the awesome "Mysql" and "MySql and Perl for the web". (BTW so far the
>little mod_perl section in "MySql and Perl for the web" has proven more
>useful then anything I've found in the whole Mod_Perl dev cookbook).
Glad to hear that about MPW; thanks. Gee, maybe I should quote your
paragraph on the book's companion web site! :-)
Regarding use of persistent connections, I wonder if you really need
them. To give an example from another language, PHP offers mysql_connect()
and mysql_pconnect() connections, which set up regular or persistent
connections. But it turns out that the difference in overhead between
the two call is minimal because MySQL's client/server protocol is so
efficient for connection establishment.
Also, persistent connections can have certain negative effects. For one
thing, because a connection remains open for a longer time, even when no
script is actively using it, you can more easily end up bumping up against
your server's max-simultaneous-connection limit. With non-persistent
connections, this is less of an issue.
>I've seen so many example and different ways to do it, that I have no idea
>if I'm doing things the safest and most optimized way. For example I've read
>a bunch of posts where people said to do pooling its only a matter of doing
>your connect like "$db || DBI->CONNECT", which just gives me a syntax error.
>I also hear in one place that "Apache::DBI" takes care of making sure the
>connection stays alive but then I hear in another that is something that I
>will need to take care of.
>Below is how I've set things up, hopefully someone out there that really
>knows can tell me if I'm doing something wrong or if it could be done
>Right now as it stands everything is running perfect under mod_perl, again
>I'm just not sure I'm doing everything the correct way.
>Thanks in Advance!