Perrin Harkins 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.

Yes, that's what I figured too. But in my tests, involving thousands
of database calls, I haven't seen any problems (yet).

 > Can you try this some more and maybe throw some artificial loads against
 > it to look for possible problems?  It would be cool if this worked, but
 > I'm very skeptical until I see it handle higher concurrency without any
 > problems.

I will *definitely* throw as much load as I can in a test/stress
environment before I make use of this in a production environment.

I'll let y'all know how this goes...

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