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/TestApache/subprocess.pm?rev=71116&view=markup
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:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com