On Tue, 5 Sep 2000, Perrin Harkins wrote:
> 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.
Just a small correction:
You can cause pages to become unshared in perl just by writing a variable,
^^^^^^^
so it's almost certain to happen sooner or later.
Or for example calling pos() which modifies the variable internals:
http://perl.apache.org/guide/performance.html#Are_My_Variables_Shared_
> 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.
>
> - Perrin
>
>
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com perl.org apache.org