Tuesday, 12 April 2016

Delayed Job vs Resque vs Sidekiq

With delayed_job:
* Pros
– incredibly quick and easy to get rolling
– no addition to your “stack”; it can run just fine with ActiveRecord
– a fantastic choice for beginners or migrating code from the foreground to the background
* Cons
– Runs on ActiveRecord, so it will probably run slower than something that runs on Redis
– Makes it very easy to mix async and sync code in file, which, in my opinion, is a bad thing
– The “.delay” calls scattered across your codebase will make it difficult to reason about six months later

With Resque:
* Pros
– It runs on Redis, which is fast
– Great separation of background code with worker classes
– It has a fantastic web dashboard
– It makes it fairly easy to do background processing
* Cons
– More difficult to get running with than delayed_job
– Still isn’t the fastest!
– Doing prioritized, time-based jobs is not as easy as delayed_job

With Sidekiq:
* Pros
– Pretty darn fast and workers are lightweight
– You can port over code really easily from Resque
– Great separation of code
* Cons
– More difficult than delayed_job
– (this is the biggie) You must use thread-safe libraries and write thread-safe code



Version Latency Garbage created for 10,000 jobs Time to process 100,000 jobs Throughput
Sidekiq 4.0.0 10ms 151 MB 22 sec 4500 jobs/sec
Sidekiq 3.5.1 22ms 1257 MB 125 sec 800 jobs/sec
Resque 1.25.2 - - 420 sec 240 jobs/sec
DelayedJob 4.1.1 - - 465 sec 215 jobs/sec

No comments:

Post a Comment