Perrin Harkins <[EMAIL PROTECTED]> writes:

> On Tue, 5 Sep 2000, Michael Peppler wrote:
> > 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).
> 
> People have suggested this before on the mod_perl list and the objection
> raised was that this will fail for the same reason it fails to open a
> filehandle in the parent process and then use it from all the children.  
> Basically, it becomes unshared at some point and even if they don't do
> things simultaneously one process will leave the socket in a state that
> the other doesn't expect and cause problems.  You can cause pages to
> become unshared in perl just by reading a variable, so it's almost certain
> to happen sooner or later.

I'd rather see a version of Apache::DBI that uses "use other_db" to
flip between different databases with the same credentials...


-- 
Dave Hodgkinson,                             http://www.hodgkinson.org
Editor-in-chief, The Highway Star           http://www.deep-purple.com
      Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -----------------------------------------------------------------

Reply via email to