Skip to content

Instantly share code, notes, and snippets.

@mperham
Last active August 29, 2015 13:57
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mperham/9880935 to your computer and use it in GitHub Desktop.
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