Sidekiq in 1 minute
1 Minute lighting talk: A simple Sidekiq Example
Big Takeaways!
- Sidekiq is crazy easy to install
- Sidekiq uses Celluloid, which is awesome
- Sidekiq is EASY to deploy too!
- YMMV: Can replace 20 resque workers with 1 Sidekiq worker
For more information, you should check out http://mperham.github.com/sidekiq/
Steps (after you clone and bundle)
-
Run the sidekiq worker
bundle exec sidekiq -r ./worker.rb
-
Run the code
ruby demo
- That's it!
On Your Own
# In your code
DoingIt.perform_async
# The worker
class DoingIt
include Sidekiq::Worker
def perform
puts "the stuff"
end
end
In Rails 3
- Add to bundler
- Add to capistrano
require 'sidekiq/capistrano'
Prereqs
- Have Redis installed and running (
brew install redis
) - Ruby 1.9