Richard F. Rebel wrote:
On Mon, 2004-02-23 at 20:34, Stas Bekman wrote:

Richard F. Rebel wrote:


Speaking of, does anyone know of a way to tell exactly how many
interpreters are running in a given process?

Sounds like a job for Apache::Status. Though it will need an API to query the interpreter pools which AFAIK don't exist yet. Or may be it'll better suite
Apache::VMonitor http://search.cpan.org/dist/Apache-VMonitor/. At the moment it will show you all the active threads for each process, though it won't tell you which one is perl and which is not.


Meanwhile if your interpreters pool is always growing and never get its items killed you can cheat and count the number of started interpreters by defining a function CLONE in some package, e.g. in httpd.conf:


Great hack Stas, but alas, I suspect(all right, I *know*) that there are
interpreters that are getting reaped in my situation.  Is there a
similar magic BLOCK for gc like the 'CLONE' convention?

I think the END block is run for every clone, I'll write a test later.


Really, the API to query the status of interpreter pools would be the best.

The CLONE special block should be documented somewhere, who shall I rag
at for that??

It's mentioned in perlmod:


       Ithreads work by cloning the data tree so that no data is shared
       between different threads. These threads can be used by using the
       "threads" module or by doing fork() on win32 (fake fork() support).
       When a thread is cloned all Perl data is cloned, however non-Perl data
       cannot be cloned automatically.  Perl after 5.7.2 has support for the
       "CLONE" special subroutine .  In "CLONE" you can do whatever you need
       to do, like for example handle the cloning of non-Perl data, if neces-
       sary.  "CLONE" will be executed once for every package that has it
       defined (or inherits it).  It will be called in the context of the new
       thread, so all modifications are made in the new area.

       If you want to CLONE all objects you will need to keep track of them
       per package. This is simply done using a hash and
       Scalar::Util::weaken().

I'm working on a full blown example and docs of where it's indispensible:
http://apache.org/~stas/Example-CLONE-0.02.tar.gz

And if I( haven't said it b4, thanks for the hard work on mp2...

Thanks for using it! ;) __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to