Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between running rake task in background vs. using gem like Delayed Job, Resque, or Sidekiq?

I need to implement some background processing to 1) send emails, 2) do some API calls. And, whatever system I use, I'll also be combining with some kind of cron scheduler (Whenever likely). I'm curious, I recognize that there's an array of really cool background processing gems (Delayed Job, Sidekiq, Resque), but I also understand that you can do background processing with just a rake task per Ryan Bate's video: http://railscasts.com/episodes/127-rake-in-background.

What are the pro/cons of using a gem VS a rake task to background process? One thing about the latter that is concerning to me is that you have to spin up a new environment every time a rake task is called, which is terribly expensive on memory.

Please note, I don't need a comparison of the gems. This series did a great job here: http://www.sitepoint.com/series/comparing-ruby-background-processing-libraries/

like image 425
james Avatar asked Jul 07 '14 05:07

james


1 Answers

Parallelism. You can have N workers sending emails in parallel. With rake you have a single thread, sending many emails will take a while.

like image 59
Mike Perham Avatar answered Oct 18 '22 10:10

Mike Perham