Search code examples
ruby-on-railsperformanceruby-on-rails-5sidekiq

How to debug slow Sidekiq jobs


Often times my Sidekiq jobs will be running for greater than 1 minute. I've tried to debug by sending the Sidekiq process a TTIN signal but I don't see anything being logged. My intuition is that it's a network request that's making it hang but I'm making use of timeouts on all network requests to address this already.

Any suggestions? Thanks!


Solution

  • You are asking how to profile and tune slow Ruby code.

    RubyProf.profile do
      MyJob.new.perform(...)
    end
    

    Output the report and review it to find where the code is slow.

    https://github.com/ruby-prof/ruby-prof#usage