equivalent8
equivalent8

Reputation: 14237

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?

Upvotes: 4

Views: 1374

Answers (1)

equivalent8
equivalent8

Reputation: 14237

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

Upvotes: 5

Related Questions