Re: RES: MP2 Forking - Untie socket

[prev] [thread] [next] [Date index for 2005/02/15]

From: vsmori
Subject: Re: RES: MP2 Forking - Untie socket
Date: 23:26 on 15 Feb 2005
Stas,

Thank you for all this usefull informations.

Regards,

Vitor


> vsmori wrote:
> > Thanks Stas, that was usefull.
> > 
> > From my undestanding, the right solution in MP2 would be
using
> > Apache::SubProcess::spawn_proc_prog function instead of
forking the
> > apache request child process and call cleanup_for_exec
(forget compat,
> > i want to be MP2 native).
> 
> Right, Vitor. But there is *no* cleanup_for_exec in mp2
API. You just 
> don't need to call it anymore. It's a noop if compat:
> 
> Apache/compat.pm:
> # this function is from mp1's Apache::SubProcess 3rd party
module
> # which is now a part of mp2 API. this function doesn't
exist in 2.0.
> sub cleanup_for_exec {}
> 
> Take a look at this example:
>
http://svn.apache.org/viewcvs.cgi/perl/modperl/trunk/t/response/TestApach=
e/subprocess.pm?rev=3D71116&view=3Dmarkup
> 
> > But using spawn_proc_prog to execute an perl code, will
not be handled
> > in mod_perl2 context (cached interpreter), correct?
> 
> It does the same fork() you'd have called yourself, but
provides you a 
> better framework to communicate with that process and
handles the cleanups 
> for you.
> 
> > What should be the correct way to fork and clean up what
is un-nedded
> > in child just to take the advantage of the speed to run
my perl 
> > execution process?
> 
> Once you fork (either way) you can't use the current
intrepreter.
> 
> > The point is the fact that my perl script that should be
executed
> > directly from the handler forks itself to do an parallel
processing.
> 
> You could try perl threads, but there are *very* expensive
to start if you 
> have a lot of things loaded into memory (since
perl_clone() dups almost 
> everything in the perl land, but the opcode tree). In the
mod_perl 
> "paradigm" this is much more expensive than fork, since
normally most of 
> the time we have lots of perl things loaded into memory.
> 
> Most likely the best solution here is to offload the job
to PPerl or some 
> other daemon, with the only added complexity of communication.
> 
> -- 
>
__________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another
mod_perl Hacker
> http://stason.org/     mod_perl Guide --->
http://perl.apache.org
> mailto:stas@xxxxxx.xxx http://use.perl.org
http://apacheweek.com
> http://modperlbook.org http://apache.org  
http://ticketmaster.com
> =0A =0A________________________________________________________________=
__________=0AAcabe com aquelas janelinhas que pulam na sua tela.=0AAntiPo=
p-up UOL - =C9 gr=E1tis!=0Ahttp://antipopup.uol.com.br/=0A

RES: MP2 Forking - Untie socket
vsmori 16:19 on 14 Feb 2005

Re: RES: MP2 Forking - Untie socket
Stas Bekman 23:05 on 15 Feb 2005

Re: RES: MP2 Forking - Untie socket
vsmori 23:26 on 15 Feb 2005

Generated at 11:21 on 20 Feb 2005 by mariachi v0.52