On Sun 18 Jan 2009, Michael Ludwig wrote:
> From perldoc perlthrtut: "In this model each thread runs in its own
> Perl interpreter, and any data sharing between threads must be
> explicit." This does not sound to me as if there is a significant
> advantage over spawning child processes, at least not on UNIX.
>
> Hmm. Not sure what to make of this threaded Perl.
In fact, it is worse than fork()ing off unix processes because the
interpreter data is completely copied while a new interpreter is
created. On the other hand a forked process copies only those pages
that are written to.
I haven't used Sleepycat::DbXml but I use BerkeleyDB in production with
prefork, see Apache2::Translation on CPAN. What I have learned is, you
can't open the BDB env in the parent apache. When I wrote that piece I
also had problems when I opened the env in the parent and then closed
it before forking children. Perhaps they are gone in a newer version.
I think with prefork opening the env in a ChildInit handler should work.
I ended up with the connect-at-first-usage approach
unless( $connected ) {
connect();
$connected=1;
}
because I test almost all my modules also with a threaded MPM and the
ChildInit hook is run once per process not once per Perl interpreter.
Torsten
--
Need professional mod_perl support?
Just hire me: [email protected]