I've come across a technique that allows modperl processes to share a 
pool of database handles. It's not something that I have seen
documented, so I figured I'd throw it out here.

The idea is to create a pool of connections during the main
apache/modperl startup. Because these connections end up in the code
segment for the child processes they are completely shareable. You
populate a hash in a BEGIN block with x connections, and then provide
some calls to grab the first available one (I use IPC::Semaphore to
coordinate access to each connection).

Based on preliminary tests I was able to use a 1 in 10 ratio of
database handles per httpd child processes, which, on a large site
would cut down on the number of connections that the database server
needs to handle.

The advantage of this solution is that connections don't go down when
the apache child dies (for example because the MAX_REQUEST per child
has been reached).

The disadvantage is that the connections can only be restarted by
restarting the webserver (apachectl stop/apachectl start).

This technique works with Sybase connections using either
DBI/DBD::Sybase or Sybase::CTlib (I've not tested Sybase::DBlib, nor
any other DBD modules).

I'd be very interested in any comments, in particular if there are any 
downsides that I haven't considered (which is quite possible).

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
[EMAIL PROTECTED]    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: [EMAIL PROTECTED]

Reply via email to