I'm not sure if this is even a problem but it's always
been on my mind. I use Apache::DBI and I have a general
module that handles db connections for my scripts. Here's
the relevant portion:
my $DBH ||= DBI->connect("...")
It basically accepts a hash ref to the dbconfig and opens
a connection. My httpd.conf is set with 5 spare clients
MIN and 10 MAX.
I'm the only one using this module right now and starting
httpd fresh results in no conections. Running my test CGI
script once results in two (2) mysql connections. Running
it again, results in four (4) connections. This will
eventually continue until the number of mysql connections
is always four (4) more than httpd processes.
The thing that I can't figure out is that my scripts
properly open and close the db connection, so why doesn't
Apache::DBI re-use the original connection? Why spawn
one more each time?
I've checked the FAQ and searched the archives and found
no info (other than someone else asking this same question
last year with no helpful answer) and the Apache:DBI man
page doesn't touch on this.
Jim