ruby-on-railsruby-on-rails-3cronnewslettermailing-list

Rails simple Newsletter / Mailing List with notification of new search results via email


My users can save their preferred searches. Now I need to give them the possibility to subscribe to them in order to receive an email notification whenever new search results are available (like on Yahoo answers).

I already set up a Mailer that, when manually triggered, is working ok.

Now all I need to do is to call the mailer from a scheduled job but... I really ain't an expert on that field. So, among Whenever, Delayed_job, Sidekiq, Resque Scheduler & co. with which one (or combination of ones) should I go for this kind of task (long-running process with several mailing)?

EDIT

I developed a working example app, available on Github: NotiSearch.

It's pretty well documented so, if you are trying to develop something like it, I'd definitely recommend you to check it out.

PS: I chose to rely on whenever and delayed_job since they don't have external dependencies, if needed it should be easy enough to transition to a more scalable solution.


Solution

  • I've personally worked with Resque and Sidekiq. The main difference between these two is that Sidekiq spawns new threads for each job.

    Resque has a process per job. This just basically mean that Resque assumes failure and other jobs won't fail if one process fails. Sidekiq, since it works with threads, if one of those threads locks up for whatever reason the entire process will be locked up.

    From an answer in another QA Resque vs Sidekiq?

    Resque:

    Pros:

    does not require thread safety (works with pretty much any gem out there); has no interpreter preference (you can use any ruby); loads of plugins. Cons

    runs a process per worker (uses more memory); does not retry jobs (out of the box, anyway). Sidekiq:

    Pros

    runs thread per worker (uses much less memory); less forking (works faster); more options out of the box. Cons

    [huge] requires thread-safety of your code and all dependencies. If you run thread-unsafe code with threads, you're asking for trouble; much less plugins (at the moment there are only 2); works on some rubies better than others (jruby and rubinius are recommended, efficiency on MRI is decreased due to GVL (global VM lock)).

    EDIT

    Anyway to answer your question. In all the projects we've used mailers we use Resque.