简体   繁体   English

由于brpop,Rails Sidekiq Redis长期运营

[英]Rails Sidekiq Redis long operation due to brpop

Newrelic monitoring on fresh Ruby on Rails application with Sidekiq, and not much logic yet implemented and not much trafic is showing that Redis is taking long time (around 2s-3s) on brpop operations. 使用Sidekiq对新的Ruby on Rails应用程序进行新的监控,并且没有太多的逻辑实现,并且没有太多的流量表明Redis需要花费很长时间(大约2s-3s)进行brpop操作。

why is that? 这是为什么?

is that an issue in terms of performance? 这是性能方面的问题吗?

based on the information in this Issue https://github.com/mperham/sidekiq/issues/2581 this is normal behaviour for Sidekiq: 根据本期https://github.com/mperham/sidekiq/issues/2581中的信息,这是Sidekiq的正常行为:

see @jonhyman comment @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. brpop也是一个阻塞命令,所以如果你没有很多工作,那么每个工作都会阻塞1秒钟。

see @ryansch comment: @ryansch评论:

You want that behavior. 你想要那种行为。 That's what sidekiq is doing while it's waiting for work. 这就是sidekiq在等待工作时正在做的事情。 It's a long running blocking operation because redis can then tell sidekiq about work as soon as it arrives. 这是一个长期运行的阻塞操作,因为redis可以在它到达时告诉sidekiq工作。 The alternative would be polling which we certainly don't want. 另一种选择是轮询我们当然不想要的。 I see the same thing in my new relic dashboard. 我在新的遗物仪表板中看到了同样的事情。 No worries. 别担心。

So no it's not an issue. 所以不,这不是问题。 Sidekiq is actually trying to be more resourceful and letting Redis to do the dirty work of letting him know when there is a new task by holding connection on that brpop operation Sidekiq实际上是在努力让自己更加足智多谋,让Redis通过在brpop操作上保持连接,让他知道什么时候有新任务让他知道

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM