Low commit activity in last 3 years
No release in over a year
Benchmarks for Sidekiq
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 1.1.1
 Project Readme

Sidekiq::Benchmark

Gem Version Ruby

Adds benchmarking methods to Sidekiq workers, keeps metrics and adds tab to Web UI to let you browse them.

Installation

Add this line to your application's Gemfile:

gem 'sidekiq-benchmark'

And then execute:

bundle

Usage

class SampleWorker
  include Sidekiq::Worker
  include Sidekiq::Benchmark::Worker

  def perform(id)
    benchmark.first_metric do
      100500.times do something end
    end

    benchmark.second_metric do
      42.times do anything end
    end

    benchmark.finish
  end
end

class OtherSampleWorker
  include Sidekiq::Worker
  include Sidekiq::Benchmark::Worker

  def perform(id)
    benchmark do |bm|
      bm.some_metric do
        100500.times do
        end
      end

      bm.other_metric do
        something_code
      end

      bm.some_metric do
        # some_metric measure continues
      end
    end
    # if block given, yield and finish
  end

end

Examples

Web UI

Web UI

Testing sidekiq workers

When you use Sidekiq::Testing you must load sidekiq-benchmark/testing to stop saving benchmark data to redis. Just add next code to your test or spec helper:

require 'sidekiq-benchmark/testing'

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request