davidnwelton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Sep-25 22:23 UTC
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> 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/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
+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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > +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 > -- > Posted via http://www.ruby-forum.com/. > > > >-- Andrew Kuklewicz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---