简体   繁体   中英

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!

You can use the benchmark module https://ruby-doc.org/stdlib-1.9.3/libdoc/benchmark/rdoc/Benchmark.html

You can then save the report to a log file.

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

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