You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Ruben Safir <ru...@mrbrklyn.com> on 2020/02/03 22:19:41 UTC

Re: AW: Embperl and threaded mpm?

On Mon, Jun 26, 2017 at 11:21:14PM -0700, Neil Gunton wrote:
> Ruben Safir wrote:
> >On 06/26/2017 07:51 PM, Neil Gunton wrote:
> >>richter@ecos.de wrote:
> >>>Hi Neil,
> >>>
> >>>Embperl is not working with threaded mpm.
> >>>
> >>>Preloading all your perl code saves a lot of memory due to code sharing.
> >>>
> >>>The main issue is, that you have to make sure, not to open any file or
> >>>database connection or similar in the preload code, because that will
> >>>be shared too, which does not work
> >>
> >>Thanks, Gerald. So, just to be clear, what my preload routine in
> >>startup.pl does is the following. Maybe you can confirm that I'm doing
> >>it right.
> >>
> >>if (Apache2::ServerUtil::restart_count() == 1)
> >>{
> >>    preload_dirs();
> >>    $Embperl::initparam{preloadfiles} = \@preload_files;
> >>}


Where did you put this code?

> >>
> >>The preload_dirs() simply traverses my code tree and calls this for each
> >>file:
> >>
> >>push (@preload_files, {inputfile => $filename, path => $path, import =>
> >>0, input_escmode => 0, options => 16, debug => 0x7fffffff});
> >>
> >>Does that look about right? If as you say it's worthwhile in terms of
> >>memory then I might look at re-enabling it again. I think I disabled it
> >>originally because it made restarting the server quite slow, but it
> >>would be useful to have it as an option should I need it.
> >>
> >
> >looks right to me although I never did this.  You are just setting up
> >the global parameters
> 
> Ok, but I'm wondering if there is something else I should be doing
> to execute the actual preload. It seems that all I do here is give
> Embperl an array, but when I enable the preload, it just goes
> through everything suspiciously quickly. I don't think it's actually
> executing anything at preload time, though I could be wrong. I'm
> thinking there's something else I need to do to tell Embperl "ok,
> now actually load all those files"...
> 
> Neil
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org

-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: AW: Embperl and threaded mpm?

Posted by Neil Gunton <ne...@nilspace.com>.
Ruben Safir wrote:
>>>> Thanks, Gerald. So, just to be clear, what my preload routine in
>>>> startup.pl does is the following. Maybe you can confirm that I'm doing
>>>> it right.
>>>>
>>>> if (Apache2::ServerUtil::restart_count() == 1)
>>>> {
>>>>    preload_dirs();
>>>>    $Embperl::initparam{preloadfiles} = \@preload_files;
>>>> }
> 
> 
> Where did you put this code?
> 

Hi Ruben, this code goes in the BEGIN block in my startup.pl.

startup.pl is referenced in the Apache config as:

PerlRequire /path/to/startup.pl

Does that help? If not I can provide more context, but that's the
essence of it.

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org