-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8251392: Consolidate Metaspace Statistics #3786
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
8251392: Consolidate Metaspace Statistics #3786
Conversation
|
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
37e1f19 to
decf5c3
Compare
decf5c3 to
e758d29
Compare
|
/cc hotspot-gc |
|
@tstuefe |
|
@zhengyu123 : could you take a look at the NMT part of this change? Thanks! |
|
Gentle ping. |
coleenp
left a comment
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 looks good to me. Nice cleanup removing duplicated metaspace counting code!
|
@tstuefe 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 274 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 |
Thank you Coleen! |
zhengyu123
left a comment
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.
Looks good.
Thanks Zhengyu! |
|
Okay, I waited but no more reviews are forthcoming. Our nightlies show no errors attributable to this change. /integrate |
|
@tstuefe Since your change was applied there have been 287 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 554caf3. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
There is a lot of duplicate coding when it comes to the consumption of Metaspace Statistics.
Metaspace offers statistical APIs via
MetaspaceUtils::(reserved|committed|used)_(words|bytes)for either the whole metaspace or non-class/class space separately. But many callers need some sort of combination of these values, which they keep in data holder structures which all are named "Metaspace" something and all do a very similar job. In particular, we have:As much as possible coding should be unified.
In addition to that, all these callers share a common problem, in that retrieving individual statistical values via
MetaspaceUtils::(reserved|committed|used)_(words|bytes)may yield inconsistent values. For example, "reserved" < "committed", or "committed" < "used". This is the cause of a variety of rare intermittent test errors in different areas, e.g. Performance counters (JDK-8163413, JDK-8153323), the gc log, the MemoryPoolMXBean and NMT (JDK-8237872).This patch introduces two new data holder structures:
MetaspaceStatsholds reserved/committed/used counterMetaspaceCombinedStatsholds an expression of these counters for class- and non-class metaspace each, as well as total counter.Furthermore, the patch introduces two new APIs in MetaspaceUtils:
MetaspaceStats get_statistics(type)MetaspaceCombinedStats get_combined_statistics()The former is used to get statistics for either non-class-space or class space; the latter gets statistics for the whole, including total values. Both APIs guarantee consistent values - reserved >= committed >= used - and never lock.
The patch uses these new data holders and these APIs to consolidate, clean up and simplify a lot of caller code, in addition to making that code resistant against inconsistent statistics:
GC Log: class
MetaspaceSizesSnapshotin metaspace/metaspaceSizesSnapshot.cpp/hpp had been used to hold metaspace statistics. Its default constructor sneakishly queried all values.MetaspaceSizesSnapshothas neem removed, caller code rewritten for MetaspaceCombinedStats and explicit value querying.NMT had class
MetaspaceSnapshotto keep metaspace statistics and to print out baseline diffs.MetaspaceSizesSnapshotwas removed and replaced withMetaspaceCombinedStats.MemSummaryDiffReporter::print_metaspace_diff()has been modified: fixed a potential div-by-zero, removed the "free" statistics which is meaningless, and massaged the code a bit.MemSummaryReporter::report_metadata()(which, if backported, should fix JDK-8237872).jstat & co: Metaspace performance counters are realized by
MetaspaceCountersandCompressedClassSpaceCounters, implementation resides inMetaspacePerfCounters(metaspace/metaspaceCounters.hpp/cpp).CompressedClassSpaceCounterssince there is no need for two APIs, class space is part of metaspace.MetaspaceMemoryPool,CompressedClassSpaceMemoryPoolused in MxBeans: I changed the implementation to return consistent values.JFR reports metaspace allocations (which, confusingly, uses a different terminology: "data_space" == non-class portion of metaspace). It used
MetaspaceSummaryto hold the statistics, which were composed ofMetaspaceSizes.MetaspaceSizesMetaspaceSummaryto useMetaspaceCombinedStatsMetaspaceUtils::print_on() has been used to print metaspace statistics (by GCs). Function has been corrected to print consistent values.
Added a simple gtest for the new APIs
Tests:
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3786/head:pull/3786$ git checkout pull/3786Update a local copy of the PR:
$ git checkout pull/3786$ git pull https://git.openjdk.java.net/jdk pull/3786/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3786View PR using the GUI difftool:
$ git pr show -t 3786Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3786.diff