perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Taras Yurij Vasylovitch <>
Subject DB connections manager in MPM mod_perl
Date Fri, 04 Nov 2005 15:43:45 GMT
Hi all. 	
My project is built on Apache+mod_perl2 + PostgreSQL, so I use DBI::Pg
to connect to database and Apache::DBI for connection reuse. My DBI
connections are initialized at ChildInit phase. I examined Apache::DBI
sources and found that it creates one connection per dsn (am i right?)
but it's not exactly what I want. I need different connection handlers
to be used in threads that work in the same process namespace, because I
want to be sure that my application works correctly in terms of heavy
load. I've tried to write my own "db connections factory" but I found
out that DBI connections cannot be shared between threads because they
are objects. I was searching in the Web but found nothing :( So I want
either already developed DB manager that have such features:
- get_connection and release_connection
- max number of connections can be specified
- start new connection only if needed (if no more thread connections
left), but not on object init
- has a counter of usages of each connection and reconnects it if
counter exceeds some limit. This is important because connection does
not load index information during work, only on connect so connection
can use old index information and I don't want it to do so.
- fast
- main requirement - fully thread-safe

or fast methods to share objects between threads. 
Thanks for any information about the theme. 

View raw message