简体   繁体   中英

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.

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:

see @jonhyman comment

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

see @ryansch comment:

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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