-
Notifications
You must be signed in to change notification settings - Fork 29
Introduce Ractor benchmarks and harness #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
9a48fe5
to
607cd5b
Compare
910d5f9
to
c1c1654
Compare
40880ac
to
fe13558
Compare
Co-Authored-By: Luke Gruber <[email protected]> Co-Authored-By: Étienne Barrié <[email protected]>
Committed seperately so the noisy diff can be easily excluded from reviews if needed.
These can be run as follows: ruby -Iharness-ractor/harness.rb benchmarks-ractor/json_parse_float/benchmark.rb Co-Authored-By: Luke Gruber <[email protected]>
Co-Authored-By: Luke Gruber <[email protected]>
If your ruby's bundler is different from the saved result in `Gemfile.lock`, bundler autoswitches by starting a new process. When it does this it sometimes doesn't pick up the old LOAD_PATH and results in a LoadError. Switch to use `Bundler.setup`, which is a simpler process and uses the current bundler.
2 implementations, one using Process.fork, and one using Ractors - for comparison
This is a copy of the Optcarrot benchmark from benchmarks/optcarrot, but modified to be compatible with multiple Ractors
Instead -Iharness-name can be used
This commit introduces a harness that can be used to chain two (or more) harnesses together. For example. To run a Ractor test with Vernier you can wrap the ractor harness with the vernier one as follows HARNESS_CHAIN="vernier,ractor" ruby -Iharness-chain benchmarks-ractor/optcarrot/benchmark.rb
This commit modifies the benchmark runner to add 2 new categories: --category=ractor-only Runs only those benchmarks in benchmarks-ractor using the Ractor harness. --category=ractor In addition to the ractor-only benchmarks, this will run benchmarks specified in benchmarks.yml with `ractor: true` using the Ractor harness. In addition to this we've modified the burn in and run once scripts to use the new harnesses and categories too Co-Authored-By: Luke Gruber <[email protected]>
Also make sure that the benchmarks list test is up to date
7841bf9
to
78f97ef
Compare
This looks good to me, but I feel I'm missing something. Are the bechmarks just copied fully in to |
Some benchmark directories were copied into |
Got it, makes sense.
If they're not buying us anything, I think we should remove them. They look like possible benchmark results? I'd hate for people to be confused by them. |
Regarding OptCarrot, have you seen https://github.com/mame/optcarrot/blob/master/bin/optcarrot-bench-parallel-on-ractor ? That seems like a nice way to make OptCarrot Ractor-compatible without copying many files. I think it's best to avoid large copies in the repo, and |
Looks good to me.
What was the change? The diff is so large that GitHub doesn't show the diff.
If this is possible, I guess we could let |
This PR introduces a set of benchmarks for assessing the performance of Ractors. The main parts of this work are
1. Introduce a set of Ractor specific performance benchmarks
A new harness
harness-ractor.rb
has been introduced. This harness will run the benchmark code inside a number of Ractors concurrently and collect timing information. By default this is 0 (ractors disabled), 1, 2, 4 and 8.A number of Ractor specific benchmarks designed to test specific scenarios of multi-ractor mode have been introduced into the
benchmarks-ractor
directory. They've also been included inbenchmarks.yml
with the name prefixractor/
.In order to run these benchmarks with the new harness a new category
ractor-only
has been introduced. The ractor only benchmarks can be run as follows:2. Adapt existing benchmarks to be Ractor compatible
Existing benchmarks in the
benchmarks
directory have been updated (where it's possible to do so in a simple manner) to be multi-Ractor safe (mostly making sure any common state is made shareable usingRactor.make_shareable
). Benchmarks that have been updated in this way have been marked insidebenchmarks.yml
withractor: true
.These tests can be run with either the normal benchmark harness or the Ractor harness, they should be expected to work with both.
A new category
ractor
has been introduced that will run all of these tests with the Ractor harness alongside the Ractor only tests mentioned above.All Ractor benchmarks can be run as follows:
Any benchmark can be run with the Ractor harness using the
run_once.sh
script in conjunction with theHARNESS
environment variableOr a category can be run using the
--harness
argument to the main benchmark runnerBut be aware that running like this will ignore the
ractor
key inbenchmarks.yml
and will run all the chosen benchmarks with the ractor harness, regardless of compatibility. Crashes are likely.3. Harness chain.
For convenience and as an aid to profiling with ractors, this PR also implements the ability to chain harnesses together. For example, running the ractor-only benchmarks through the Vernier profiler can be done as follows: