I know very little about forking the ruby process but am running into a problem where I need to move some processing to a background task. What''s the main differences (pros/cons) between using Backgroundrb or a Forking plugin like Spawn (http://rubyforge.org/projects/spawn/)? The problem I''m trying to solve is that at the end of an event creation flow we need to send out an email to all the users who were invited. This list can be long for large events, so it tends to take some time. Also, it might be important to know that my server has limited RAM (512MB) and is running a Mongrel cluster behind Apache. Thanks, Jeremy Gillick http://mixermixer.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 -~----------~----~----~----~------~----~------~--~---
Oh, and to add to that, what about AP4R (http://ap4r.rubyforge.org/ wiki/wiki.pl?HomePage)? On Jun 5, 1:00 am, Mozmonkey <JeremyMail...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I know very little about forking the ruby process but am running into > a problem where I need to move some processing to a background task. > What''s the main differences (pros/cons) between using Backgroundrb or > a Forking plugin like Spawn (http://rubyforge.org/projects/spawn/)? > > The problem I''m trying to solve is that at the end of an event > creation flow we need to send out an email to all the users who were > invited. This list can be long for large events, so it tends to take > some time. > > Also, it might be important to know that my server has limited RAM > (512MB) and is running a Mongrel cluster behind Apache. > > Thanks, > Jeremy Gillickhttp://mixermixer.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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 05 June 2008 10:00:18 Mozmonkey wrote:> The problem I''m trying to solve is that at the end of an event > creation flow we need to send out an email to all the users who were > invited. This list can be long for large events, so it tends to take > some time.The options I''ve heard of are: starfish backgroundrb ap4r system scheduler jobs> Also, it might be important to know that my server has limited RAM > (512MB) and is running a Mongrel cluster behind Apache.If you find your box paging in and out a lot, you might wanna try fronting with nginx instead. Its memory footprint isn''t much different from that of the grep process I used to find it. :-) Ciao, Sheldon. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFIR8J9pGJX8XSgas0RAkNrAJ453KwXBXTLzC6eNGDFmT6Mzgj0pgCgjGas S1SIRjONkPXpIVqYSHdOPm4=ulHg -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rschenk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jun-05 12:29 UTC
Re: Backgroundrb vs Forking/Threading
I''m currently using Backgroundrb, although at Railsconf last week, Ezra says he recommended using BJ (BackgroundJob) instead. I didn''t attend the session on asynchronous processing, just heard it mentioned by some other people, so I don''t know any more details besides that. On Jun 5, 4:00 am, Mozmonkey <JeremyMail...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I know very little about forking the ruby process but am running into > a problem where I need to move some processing to a background task. > What''s the main differences (pros/cons) between using Backgroundrb or > a Forking plugin like Spawn (http://rubyforge.org/projects/spawn/)? > > The problem I''m trying to solve is that at the end of an event > creation flow we need to send out an email to all the users who were > invited. This list can be long for large events, so it tends to take > some time. > > Also, it might be important to know that my server has limited RAM > (512MB) and is running a Mongrel cluster behind Apache. > > Thanks, > Jeremy Gillickhttp://mixermixer.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> starfish > backgroundrb > ap4r > system scheduler jobs > BackgroundJobWow, I have more things to look into now. :)> ...you might wanna try fronting with nginx instead...Good idea, I think I will try this. But overall, I''m wondering what the big difference between using a program like BackgroundRb or BackgroundJob vs. just using a plugin like Spawn to fork the process inline. Is there an advantage to installing another server to run the background jobs? Are there downsides to forking the process inline? My site already has a community so I don''t have much room for experimentation since I want to keep them happy. :) I would like learn from other people''s experiences and use those to build on my own. Thanks, Jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Fri, Jun 6, 2008 at 1:07 AM, Mozmonkey <JeremyMailing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> >> starfish >> backgroundrb >> ap4r >> system scheduler jobs >> BackgroundJob > > Wow, I have more things to look into now. :) > >> ...you might wanna try fronting with nginx instead... > > Good idea, I think I will try this. > > But overall, I''m wondering what the big difference between using a > program like BackgroundRb or BackgroundJob vs. just using a plugin > like Spawn to fork the process inline. Is there an advantage to > installing another server to run the background jobs? Are there > downsides to forking the process inline? >You should never fork processes inline in Ruby. Thats asking for trouble. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 05 June 2008 21:37:45 Mozmonkey wrote:> But overall, I''m wondering what the big difference between using a > program like BackgroundRb or BackgroundJob vs. just using a plugin > like Spawn to fork the process inline. Is there an advantage to > installing another server to run the background jobs?Yes. Once it''s started up, it''s fast. More importantly, because it''ss a service, it can be interrogated as to its state.> Are there > downsides to forking the process inline?Yes. You''ll be forking a 50MB minimum process image, for a start. It''s also not a great idea from within a Rails request handler for numerous reasons relating to resource contention, and is certainly not supported. Ciao, Sheldon. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFISQrJpGJX8XSgas0RAlAIAKC1PQC5i5k4pI+QciXXYNMNIRU/gwCfQ0Z4 PoseuBrQbwMpv1GvRHLLey8=xfVs -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > Yes. You''ll be forking a 50MB minimum process image, for a start. It''s > also not a great idea from within a Rails request handler for numerous > reasons relating to resource contention, and is certainly not > supported. >That is precisely what I wanted to know, thanks. With that in mind, how do the various background servers stack up against each other? How should I choose one? Thanks, Jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
From the limited documentation I find for BackgroundJob and Ap4r, it seems they are not tied with the Rails backend and might not have access to the models. Is this true? For my application I would like to pass model objects to the background runner. Is this possible? Thanks, Jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 06 June 2008 22:57:53 Mozmonkey wrote:> From the limited documentation I find for BackgroundJob and Ap4r, it > seems they are not tied with the Rails backend and might not have > access to the models. Is this true?Hmmm, not sure where you got that idea? Take a look here: http://backgroundrb.rubyforge.org/ Looks like backgroundrb and Rails getting pretty intimate. :-) Ciao, Sheldon. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFISvG0pGJX8XSgas0RAg9/AJ0bl1wAc5i+cl+7xgao7A/78Vb5MgCgoiYg Itseehd7cP/JgoMTgnS23+I=bUwr -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mozmonkey wrote:> From the limited documentation I find for BackgroundJob and Ap4r, it > seems they are not tied with the Rails backend and might not have > access to the models. Is this true? > > For my application I would like to pass model objects to the > background runner. Is this possible? > > Thanks, > JeremyIn any ruby script all you need to do is require your config/environment.rb, and you''ll be running your rails app. BackgrounDRb running as a plugin for rails will deal with this for you automatically. -- 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 -~----------~----~----~----~------~----~------~--~---