-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8340490: Shenandoah: Optimize ShenandoahPacer #21099
Conversation
👋 Welcome back xpeng! A progress list of the required criteria for merging this PR into |
@pengxiaolong This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 117 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@shipilev) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@pengxiaolong The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to remember why we even bothered to go into negative budget on this path, and then waited for it to recover. I think it is from here: https://mail.openjdk.org/pipermail/shenandoah-dev/2018-April/005559.html. AFAICS, the intent for that fix was to make sure that unsuccessful pacing claim the budget, which this patch also does. And given it apparently improves performance, I don't mind it going in.
Comprehension question: the actual improvement comes from waiting in 1ms slices, not from anything else? In retrospect, it is silly to wait until the deadline before attempting to claim the pacing budget.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am good with this, assuming performance runs show good results.
Webrevs
|
It is primarily from the algorithm change with 1ms slices. The behavior has been changed in the new algorithm with 1ms slices, e.g. when 10 threads seeming insufficient budget at the same time, assuming each of them claim 100 budget, in old algorithm all of the 10 threads forcefully claim the budget and result in |
Latency wise, in most time it is better than old impl. In my specific test with 8G heap on MacOS, throughput is very close to the test w/ ShenandoahPacing disabled, and about 25%~30% improvement comparing the old implementation. |
It is great it improves targeted tests, and it makes sense from the first principles. Run our usual performance pipeline to sanity check if this affects any other benchmarks in any meaningful way. |
Performance pipeline showed improvments in most Dacapo benchmarks, we did found very small regression in Dacapo Spring max latency(<1%?), tried to reproduce it with bare metal instance and can't really stably reproduce the regression, sometime better and sometime worse, it could be just noises. |
@shipilev Need you to review it again since I pushed minor refactor and format change as per your comments. |
Thanks all for the reviews! /integrate |
@pengxiaolong |
/sponsor |
Going to push as commit 65200a9.
Your commit was automatically rebased without conflicts. |
@shipilev @pengxiaolong Pushed as commit 65200a9. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
In a simple latency benchmark for memory allocation, I found ShenandoahPacer contributed quite a lot to the long tail latency > 10ms, when there are multi mutator threads failed at fast path to claim budget here, all of them will forcefully claim and them wait for up to 10ms(code link)
The change in this PR makes ShenandoahPacer impact long tail latency much less, instead forcefully claim budget and them wait, it attempts to claim after waiting for 1ms, and keep doing this until: 1/ either spent 10ms waiting in total; 2/ or successfully claimed the budget.
Here the latency comparison for the optimization:
With the optimization, long tail latency from the test code below has been much improved from over 20ms to ~10ms on MacOS with M3 chip:
Additional test
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21099/head:pull/21099
$ git checkout pull/21099
Update a local copy of the PR:
$ git checkout pull/21099
$ git pull https://git.openjdk.org/jdk.git pull/21099/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 21099
View PR using the GUI difftool:
$ git pr show -t 21099
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21099.diff
Webrev
Link to Webrev Comment