-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8299234: JMX Repository.query performance #11758
Conversation
👋 Welcome back abakhtin! A progress list of the required criteria for merging this PR into |
@alexeybakhtin The following label 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 list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Hi, |
I see several issues with the proposed changes: ObjectName is not final, so I'm not sure the changes proposed to ObjectName are safe when/if a subclass is supplied. And in addition, because it's not final, you will need to make a defensive copy of the input parameter in Repository::query and do the matching against the copy. |
Hi @dfuch, Thank you for review! Even with defensive copy the performance is improved for ObjectName subclasses: |
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.
Using ObjectName::getInstance
for the defensive copy is the right choice since it will only make a copy if the argument is a subclass. That looks good. I see your point about using _canonical_name
. Technically this is still an observable change of behaviour - so it might be preferable to file a CSR if you want to proceed with the changes made to ObjectName
.
Regardless of that these changes seem to be introducing a bug (see my other comment inline).
src/java.management/share/classes/javax/management/ObjectName.java
Outdated
Show resolved
Hide resolved
Hi Alexey - you have addressed most of my concerns but let me reinstate that the changes to ObjectName are observable by subclasses and thus will require a CSR. As such this fix may also not be a good candidate for backport (if that was your intention), as it comes with a potential regression risk. A possibility could be to implement the ObjectName changes as a separate PR. |
Hi Daniel, Yes, I'd like to backport these changes to JDK11 and 8. Such modifications to the OjectName could be unacceptable risky. I have reverted all changes in the ObjectName class.
After:
|
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 don't see an obvious issue with the proposed changes. Do you have a JMH benchmark to prove the new code is faster? Also please obtain a review from a maintainer of the servicieability area before integrating.
@dfuch, I've returned ObjectName optimization for the instances of ObjectName class only.
Benchmark results for the proposed implementation:
JmxBenchmark.applyForMyObjectName - tests ObjectName.apply() for subclasses of ObjcetName instances JmxBenchmark is attached to the https://bugs.openjdk.org/browse/JDK-8299234 @sspitsyn, Could you please look at the proposed enhancement |
@sspitsyn, Could you take a look at the proposed enhancement or suggest someone who can review it? Thank you |
@AlanBateman, Could you please take a look at the proposed performance improvement? It is required to reduce high CPU utilization caused by unnecessary HashTable cloning in the ObjectName::getKeyPropertyList(). I also would like to backport it to 17, 11 and 8 if the changes are acceptable. |
Hi Alexey, |
Thank you! |
Yes, I think it looks good. It's a bit of a style nit but our ifs always use brackets, so I miss that in ObjectName.matchDomains(), particularly as the statements are multi-line. I tested the change with test/jdk/javax/management/ and everything still passes. |
src/java.management/share/classes/javax/management/ObjectName.java
Outdated
Show resolved
Hide resolved
/integrate |
@alexeybakhtin This pull request has not yet been marked as ready for integration. |
@kevinjwalls, Thank you very much for reviewing. |
Alexey, two reviews are normally required before integration in the Serviceability area. |
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.
This last version LGTM
@alexeybakhtin 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 824 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. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 9a79722.
Your commit was automatically rebased without conflicts. |
@alexeybakhtin Pushed as commit 9a79722. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
@sspitsyn The command |
Please find a patch to improve JMX Repository.query performance
Using ObjectName.apply() allows significantly decrease memory usage and the number of GC cycles:
Before:
After:
Private ObjectName.matchDomains() method is also updated to minimize unnecessary memory allocation.
All javax/management jtreg tests passed successfully.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11758/head:pull/11758
$ git checkout pull/11758
Update a local copy of the PR:
$ git checkout pull/11758
$ git pull https://git.openjdk.org/jdk pull/11758/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11758
View PR using the GUI difftool:
$ git pr show -t 11758
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11758.diff