Fork() for long running calculations?

Hi,

I’m thinking of using fork() for long running calculations in some
code of mine, that’s run via the Apache fcgid module. It’s some heavy
calculation/db work that, however, doesn’t need to send anything back
to the user. Are there any problems with this approach?

Thanks,
Dave

I’m thinking of using fork() for long running calculations in some
code of mine, that’s run via the Apache fcgid module. It’s some heavy
calculation/db work that, however, doesn’t need to send anything back
to the user. Are there any problems with this approach?

Look into backgroundrb first… might work better for you…

http://backgroundrb.rubyforge.org/

fork() is a lot simpler. The only issue was if your process failed-
you end up with zombie processes that dont get cleaned up until
reboot. I use it though - make sure you exit gracefully.

+1 for BackgrounDRb. It’s made exactly for stubbing out longer running
processes, and I find it a breeze to set up. Not relying on fork() has
the added advantage that you could get it to work on JRuby or Windows at
some point in time. (Note that BackgrounDRb currently doesn’t support
Windows either.)


Roderick van Domburg
http://www.nedforce.com

though late to the thread, I would recommend activemessaging - just send
a
message to a queue, and it can be picked up and processed by another
process
(remote or local). Nice thing is you fire and forget - you don’t have
to
worry about who processes the message or where it gets processed.

http://code.google.com/p/activemessaging/

-A

On 9/26/07, Roderick van Domburg [email protected]
wrote:

http://www.nedforce.com

Posted via http://www.ruby-forum.com/.


Andrew K.