Home

Awesome

Rust Sidekiq server

Description

An example of simple sidekiq-compatible server which performs Sidekiq jobs.

This server does not require to change any Ruby code, neither for pushing jobs to queues nor for using workers.

Performace

10000 jobs

sidekiq - 3.42 sec
rust_sidekiq - 0.94 sec (~3.63 times faster)

Technologies

Current limitations

Usage

  1. Compile Rust library
$ cd ext/rust_sidekiq
$ cargo build --release

$ cd ../..

Mac OS X only:

cp ext/rust_sidekiq/target/release/librust_sidekiq.dylib ext/rust_sidekiq/target/release/librust_sidekiq.bundle
  1. Install sidekiq gem
$ bundle install
  1. Push some Sidekiq jobs to the queue
$ bundle exec ruby bin/push.rb
  1. Start rust_sidekiq server
$ bundle exec ruby bin/server.rb
  1. You can also push another 10k jobs and start real Sidekiq server
$ bundle exec ruby bin/push.rb
$ bundle exec sidekiq -r ./lib/worker/printer.rb -c 1

Special thanks go to Julien Blanchard whose article inspired for creating this example with both Rust and Ruby!