Rails 由于 brpop,Sidekiq Redis 长时间运行

Rails Sidekiq Redis long operation due to brpop

使用 Sidekiq 在 Rails 应用程序上对新鲜 Ruby 进行 Newrelic 监控,尚未实现太多逻辑,也没有多少流量显示 Redis 在 brpop 操作。

这是为什么?

这是性能方面的问题吗?

基于本期信息 https://github.com/mperham/sidekiq/issues/2581 这是 Sidekiq 的正常行为:

查看@jonhyman评论

brpop is a blocking command, too, so if you don't have a lot of jobs then each one will block for 1 second.

@ryansch评论:

You want that behavior. That's what sidekiq is doing while it's waiting for work. It's a long running blocking operation because redis can then tell sidekiq about work as soon as it arrives. The alternative would be polling which we certainly don't want. I see the same thing in my new relic dashboard. No worries.

所以不,这不是问题。 Sidekiq 实际上是在尝试变得更加足智多谋,让 Redis 完成一些肮脏的工作,通过在 brpop 操作

上保持连接来让他知道何时有新任务