I prepared a simple benchmark: https://github.com/mpan-wework/sidekiq-benchmark/actions?query=workflow%3ARSpec
CreateUserJob
behaves like Benchmark Job
"CreateUserJob-0, 1601366451612"
"CreateUserJob-last, 500, 1601366532766"
runs for 501 times
PureJob
behaves like Benchmark Job
"PureJob-0, 1601366532791"
"PureJob-last, 500, 1601366542691"
runs for 501 times
CreateUserWorker
behaves like Benchmark Worker
"CreateUserWorker-0, 1601366542695"
"CreateUserWorker-last, 500, 1601366621057"
runs for 501 times
PureWorker
behaves like Benchmark Worker
"PureWorker-0, 1601366621072"
"PureWorker-last, 500, 1601366630103"
runs for 501 times
Finished in 2 minutes 58.5 seconds (files took 1.72 seconds to load)
4 examples, 0 failures
The benchmark result is run over github actions with one postgres container as database and one redis container as cache.
Pure job or worker only contains in-memory commands, CreateUser job or worker will create 100 users through SQL.
0 represents the timestamp of the first job/worker to run; when every job/worker finishes, it will write its id and end time to cache, so last represents the last job/worker.
For each type of job/worker, 501 items are enqueued.
From the data collected, PureJob takes 9.900 seconds while PureWorker takes 9.031 seconds; CreateUserJob takes 81.154 seconds while CreateUserWorker takes 78.362 seconds. Sidekiq worker is faster than ActiveJob with Sidekiq adapter, but not as much as stated.
I have not yet tested on kubernetes cluster with multiple rails and sidekiq pods, but I guess the difference would not be significant.