Skip to content

Instantly share code, notes, and snippets.

@mperham
Last active January 7, 2022 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mperham/dcf7fca8e14ddee235be9c3bed9bcda6 to your computer and use it in GitHub Desktop.
Save mperham/dcf7fca8e14ddee235be9c3bed9bcda6 to your computer and use it in GitHub Desktop.
Truffle 21.3.0 vs MRI 2.7.2

This benchmark creates 100,000 jobs in Redis, boots Sidekiq with 10 threads and waits for all jobs to be processed. This is not a microbenchmark -- it is a "macrobenchmark" designed to test real system throughput.

Code is at https://github.com/mperham/sidekiq/blob/main/bin/sidekiqload

❯ bundle exec bin/sidekiqload
truffleruby 21.3.0, like ruby 2.7.4, GraalVM CE Native [x86_64-darwin]
2022-01-07T16:56:17.644Z pid=40281 tid=29xt INFO: Booting Sidekiq 6.3.2 with redis options {:db=>13, :port=>6380}
2022-01-07T16:56:36.557Z pid=40281 tid=29xt ERROR: Created 100000 jobs
2022-01-07T16:56:36.559Z pid=40281 tid=29xt ERROR: Simulating 1ms of latency between Sidekiq and redis
2022-01-07T16:57:59.338Z pid=40281 tid=zfhd ERROR: Done, 100000 jobs in 82.779995 sec
2022-01-07T16:57:59.340Z pid=40281 tid=zfhd ERROR: Now here's the latency for three jobs
0.02280902862548828
0.009525060653686523
0.005878925323486328
❯ chruby 2.7
❯ bundle exec bin/sidekiqload
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin20]
2022-01-07T16:58:30.886Z pid=40471 tid=te3 INFO: Booting Sidekiq 6.3.2 with redis options {:db=>13, :port=>6380}
2022-01-07T16:58:33.869Z pid=40471 tid=te3 ERROR: Created 100000 jobs
2022-01-07T16:58:33.869Z pid=40471 tid=te3 ERROR: Simulating 1ms of latency between Sidekiq and redis
2022-01-07T16:58:55.482Z pid=40471 tid=t5b ERROR: Done, 100000 jobs in 21.612207 sec
2022-01-07T16:58:55.482Z pid=40471 tid=t5b ERROR: Now here's the latency for three jobs
0.004197835922241211
0.003041982650756836
0.0031812191009521484

Result: 82 sec vs 21 sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment