Sidekiq worker utilization
Here's a one-liner for measuring your sidekiq worker utilization (active threads / total possible threads). E.g., if you have 4 sidekiq processes working, each with a concurrency of 20, you'd see something like this with pgrep:
... [1 of 20 busy]
... [0 of 20 busy]
... [0 of 20 busy]
... [0 of 20 busy]
In this case, we have 1.25% utilization, which the following ruby one-liner will print as "1.25":
pgrep -lf busy | ruby -e "working, total = ARGF.each_with_object([0.0, 0.0]) {|l, p| l.scan(/(\d+) of (\d+)/).first.each_with_index {|n, i| p[i] += n.to_f } }; puts (working / total) * 100"
Written by Benjamin Curtis
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#