ruby Resque vs Sidekiq?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11580954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 05:18:36  来源:igfitidea点击:

Resque vs Sidekiq?

rubyruby-on-rails-3resquesidekiq

提问by Bhushan Lodha

I am currently using Resquefor my background process but recently I heard a lot of huff-buff about sidekiq. Could anybody compare/differentiate?

我目前正在使用Resque我的后台进程,但最近我听到了很多关于sidekiq. 有人可以比较/区分吗?

In particular I would like to know is there a way to monitor programmatically whether a job is completed in sidekiq

特别是我想知道有没有办法以编程方式监视作业是否在 sidekiq

回答by Sergio Tulentsev

Resque:

要求:

Pros:

优点:

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;
  • works on some rubies better than others (jruby is recommended, efficiency on MRI is decreased due to GVL (global VM lock)).
  • [巨大]需要您的代码和所有依赖项的线程安全。如果你用线程运行线程不安全的代码,你就是在自找麻烦;
  • 在某些红宝石上比其他红宝石效果更好(推荐使用 jruby,由于 GVL(全局 VM 锁定),MRI 的效率会降低)。

回答by Firoz Ansari

Ryan has created a webcast for Sidekiq this week which also include some comparison with Resque. You probably want to check it out:

Ryan 本周为 Sidekiq 创建了一个网络广播,其中还包括与 Resque 的一些比较。你可能想看看:

Url: http://railscasts.com/episodes/366-sidekiq

网址:http: //railscasts.com/episodes/366-sidekiq

回答by Gurpartap Singh

From the question:

从问题:

In particular I would like to know is there a way to monitor programmatically whether a job is completed in sidekiq

特别是我想知道有没有办法以编程方式监控作业是否在 sidekiq 中完成

Here's a solution for that:

这是一个解决方案:

  1. Sidekiq::Status gem
  2. Batch API (Sidekiq Pro) - usage
  1. Sidekiq::状态宝石
  2. Batch API (Sidekiq Pro) -用法