Skip to content

Instantly share code, notes, and snippets.

@mperham

mperham/bench.rb

Last active Aug 29, 2015
Embed
What would you like to do?
Sidekiq performance 2014
require 'sidekiq'
class LazyWorker
include Sidekiq::Worker
def perform
# nothing
end
end
Sidekiq.configure_client do |config|
Sidekiq.redis {|conn| conn.flushdb }
50.times do
Sidekiq::Client.push_bulk('class' => LazyWorker, 'args' => [[]]*1000)
end
end
Sidekiq.configure_server do |config|
config.server_middleware.remove Sidekiq::Middleware::Server::Logging
end
Clone the Sidekiq repo. Put bench.rb above in the root. Load the jobs with:
bundle exec ruby bench.rb
Process the jobs with:
bundle exec sidekiq -r ./bench.rb
I had to add a line to Sidekiq's Manager to print out a timestamp once N jobs had been processed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment