You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Arthur M. Kang" <ar...@levelogic.com> on 2000/04/26 19:22:30 UTC

Subprocesses and Forking

I've read through the modperl guide on Forking
(http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subprocess)
and have seen some posts regarding it, but can't seem to determine what
is the most effective way to fork off a long subprocess.

Can somebody point me in the right direction??

Currently, my first option is to create a new http request from within
the modperl process and call a secondary cgi (regular).  The secondary
cgi will fork, quickly return a status code in the child, and continue
on with the long process in the parent.  The modperl process would have
received the reponse code pretty quickly, continued and ended.

Can anyone see any inherant problems with this approach?  Can someone
suggest something simpler or easier or better or more effective?

ANY comments will be greatly appreciated!

TIA,

Arthur


Re: Subprocesses and Forking

Posted by jb...@dslreports.com.
A better way? how about the httpd stuffs a new record to an SQL
table and returns, and then have another daemon that just pulls off
new records from the top of the SQL table for processing sequentially...
that way you process them as fast as you can, but dont give a bad guy
(or a bad spider) a chance to create 100s of subprocesses on your
box simply by repeated hits. Plus you can store all the results of
the subprocess run against the same record, completion time, status
etc etc..
otherwise how do you know the subprocess completed properly, where
does it store its results and exit status, if any. If you dont
have mysql setup, this is a good excuse to start ;)
-Justin

On Wed, Apr 26, 2000 at 10:22:30AM -0700, Arthur M. Kang wrote:
> I've read through the modperl guide on Forking
> (http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subprocess)
> and have seen some posts regarding it, but can't seem to determine what
> is the most effective way to fork off a long subprocess.
> 
> Can somebody point me in the right direction??
> 
> Currently, my first option is to create a new http request from within
> the modperl process and call a secondary cgi (regular).  The secondary
> cgi will fork, quickly return a status code in the child, and continue
> on with the long process in the parent.  The modperl process would have
> received the reponse code pretty quickly, continued and ended.
> 
> Can anyone see any inherant problems with this approach?  Can someone
> suggest something simpler or easier or better or more effective?
> 
> ANY comments will be greatly appreciated!
> 
> TIA,
> 
> Arthur