Kong Li wrote:

> Hi,
> 
> I have an application that runs multiple Perl scripts.  The number of the
> script as well as the content of the script are determined at run time.  One
> can also dynamically add/delete Perl scripts at runtime.  Each script is
> executed once in every n minutes.
> 
> My current Perl engine is built with 5.6.1 "-Duseithreads -Dusethreads".
> Each Perl script is hosted by one separate Perl engine on a thread.  The
> footprint of each instance of Perl engine is about 1MB on Solaris 5.8.
> 
> In order to reduce the memory footprint of the process, I was wondering if
> there is any way to create a pool of fixed-number Perl engines to run these
> scripts.  That is, when it's time to execute a script, the script is
> assigned to one of the Perl engines from the pool.  When the current
> interval of the script is done, the Perl engine is returned back to the
> pool.
> 
> If possible, each script should be able to be bound to ANY Perl engine
> within the pool.  If not, a static binding (e.g., script X is always
> executed by Engine #1) is ok as well.
> 
> I have read perlembed, in particular, the sections "maintaining a persistent
> intepreter" and "maintaining multiple intepreter instances".  The method
> described in these sections statically binds each script to one specific
> engine.  I do have the issues of namespace and variable scoping unless I
> modify these Perl scripts.
> 
> I was hoping there is some other workaround so that I do not need to modify
> any script.  Also, can perl_clone() help?
> 
> Any comments/hints/suggestions are welcome.  Please reply by email, and I
> will summarize if there is sufficient interest.

I think that you want to look at mod_perl 2.0, it's not released yet, but can serve as 
an example for your purpose. Here are some docs that Doug wrote:

http://www.apache.org/~dougm/modperl_2.0.html#mod_perl%20and%20threaded%20mpms

Grab the latest cvs snapshot of the code here:
http://cvs.apache.org/snapshots/modperl-2.0/

The code you are looking for is in modperl-2.0/src/modules/perl/....

Read the rest of Doug's doc for hints how to get the memory footprint lower.

Hope this helps.



_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/

Reply via email to