Last active
August 29, 2015 13:57
-
-
Save mperham/9880935 to your computer and use it in GitHub Desktop.
Sidekiq performance 2014
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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