Info about mp2 and threaded MPMs
am 29.12.2008 23:10:29 von Craig MacKenna
I'm about to try a threaded MPM for my largely mod_perl2-based web site.
Maybe my search skills are going downhill, but I haven't found much
material about how to modify my scripts for the threaded environment.
The first step is done, namely to minimize use of global variables. I'm
pretty sure that the few that remain need to be marked as "shared" and
in some cases need to have mutual exclusion zones around their use.
It's confusing that Apache2 and perl5.8 have separate mutual-exclusion
mechanisms. For no good reason my instinct is to use the Apache2
mutexes.
Comments on the mutual exclusion alternatives will be welcome, as will
suggestions for printed or online books, tutorials, and other words
about
threading and mod_perl2.
Thanks and HNY,
cmac
www.animalhead.com
Re: Info about mp2 and threaded MPMs
am 29.12.2008 23:37:30 von aw
craig@animalhead.com wrote:
[...]
My own not very reliable 2 cent :
The mod_perl 2 User's Guide (Pub: Onyx Neon, authors: Stas Beckman and
Jim Brandt) has apparently only part of 2 pages (365-366) on the subject.
Also, the Suse Enterprise Linux 10.x system that I recently installed
for a customer has a worker (threaded) Apache2 + mod_perl2 installed by
default.
None of the above constitute firm recommendations, but in the absence of
forecasts of doom, I would tend to see these as encouraging signs.
Apart of the usual warnings about the underlying thread-safety of
underlying C libraries, there are apparently a couple of potentially
nasty side-effects, such as if you would be using chdir() in some of
your modules (because a chdir in one thread affects all the others).
There is a reference in the book to this, which I have not checked myself :
http://www.perl.com/lpt/2002/06/11/threads.html
Re: Info about mp2 and threaded MPMs
am 30.12.2008 01:19:24 von Craig or Merikay MacKenna
One of the fun aspects of this is that the dark-blue-going-
on-purple book (which I have) describes how global variables
are sometimes shared between threads if they're not declared
shared, while your linked page says "only data that is
explicitly requested to be shared will be shared between
threads".
I think both are correct within their frame of reference,
the latter page is not talking about mod_perl2 nor threads
created by Apache2.
I used to like new subjects to learn about...
cmac
On Dec 29, 2008, at 2:37 PM, Andr=E9 Warnier wrote:
> craig@animalhead.com wrote:
> [...]
> My own not very reliable 2 cent :
>
> The mod_perl 2 User's Guide (Pub: Onyx Neon, authors: Stas Beckman =20
> and Jim Brandt) has apparently only part of 2 pages (365-366) on =20
> the subject.
> Also, the Suse Enterprise Linux 10.x system that I recently =20
> installed for a customer has a worker (threaded) Apache2 + =20
> mod_perl2 installed by default.
> None of the above constitute firm recommendations, but in the =20
> absence of forecasts of doom, I would tend to see these as =20
> encouraging signs.
>
> Apart of the usual warnings about the underlying thread-safety of =20
> underlying C libraries, there are apparently a couple of =20
> potentially nasty side-effects, such as if you would be using chdir=20
> () in some of your modules (because a chdir in one thread affects =20
> all the others).
> There is a reference in the book to this, which I have not checked =20
> myself :
> http://www.perl.com/lpt/2002/06/11/threads.html