Mailing List Archive

sharing database handles with mod_perl enablement?
Is there anyway to ensure a database handle is not being used by more than one process on the machine at one time without developing one's own locking mechanisms?

We want to limit the number of connections to our database. If the same .epl page is being hit 50 times simultaneously, we risk an attempt of 50 simultaneous database connections... which is too many.

I am using DBIx::Recordset and can check $DBIx::Recordset::numOpen for the number of open database connections, but, under mod_perl with Embperl $numOpen will not vary if the same open handle is being used by more than one process... or am I mistaken?




Terrence Brannon
90 St. Mark's Place
Apt. 2E North
Staten Island, NY 10301
914-755-4360


---------------------------------
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
RE: sharing database handles with mod_perl enablement? [ In reply to ]
Is there anyway to ensure a database handle is not being used by more than
one process on the machine at one time without developing one's own locking
mechanisms?

We want to limit the number of connections to our database. If the same
.epl page is being hit 50 times simultaneously, we risk an attempt of 50
simultaneous database connections... which is too many.

I am using DBIx::Recordset and can check $DBIx::Recordset::numOpen for the
number of open database connections, but, under mod_perl with Embperl
$numOpen will not vary if the same open handle is being used by more than
one process... or am I mistaken?

Every Apache child will have his own DBI database handle. You can't avoid
this unless you develop your own locking mechinsmus and explicitly
disconnect from the database if too many handles are open.

The other possibility is to use DBI-Proxy to make your database connection.
In this case DBI Proxy will hold the database handles for you and you can
tell DBI Proxy how many current database connections are allowed.

Gerald