-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8262074: Consolidate the default value of MetaspaceSize #2675
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
JDK-8262074: Consolidate the default value of MetaspaceSize #2675
Conversation
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
Webrevs
|
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 to me. I would suggest changing the RFE title to something like "Consolidate the default value of MetaspaceSize".
@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 61 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 |
|
Mailing list message from Stefan Karlsson on hotspot-dev: Hi Thomas, On 2021-02-23 06:31, Thomas Stuefe wrote:
I think it makes sense to get rid of this difference between build
What would the motivation be for wanting to lower the size of Thanks, |
(skip)
Initial metaspace usage is probably much lower than it was when these sizes were thought up. For one, due to the CDS, which is usually on. Then, due to the reduced waste in metaspace. See measurements. This may matter for low-consumption JVMs which do class unloading - since you would never hit the threshold, you may never clean up, unless the GC runs due to other reasons. But I admit that I do not have a good base upon which to decide which size is right. Once could say "you must be able to load as many classes as you did when this limit was thought up" which would mean we could lower the limit much more aggressivly than I did. Or we could say "dont shake the boat" and leave the limits as they are. I tried to find a middle way. However, it also makes sense to keep the limits as they are. Then this patch is truly just a cleanup. I now set the 32bit limit to 16M, which is what we did have before; the 64bit threshold is set to 21M, which is 0.25M more than before, just to have a nice round number.
Thanks, Thomas |
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. I appreciate the more conservative approach and doing this as a cleanup.
Thank you Coleen! |
/integrate |
@tstuefe Since your change was applied there have been 75 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit c9e9189. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
I was looking at whether the default values for MetaspaceSize (the initial threshold to start off a metaspace-motivated GC) still make sense after JEP-387.
The default is dependent on compiler tier and bitness. It is also spread across all platforms.
In addition to that, it also may get modified after Metaspace::ergo_initialize() in client-compiler-emulation-mode:
jdk/src/hotspot/share/compiler/compilerDefinitions.cpp
Lines 194 to 196 in 2b00367
which is unexpected and causes confusion (eg JDK-8261907, JDK-8261907).
The reasons for this seem to originate from PermGen times:
https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2021-February/045536.html
Today, MetaspaceSize defaults to:
I was surprised to see that they do not depend on any compiler runtime switches. It only depends on build time decisions.
How much do we use? I analyzed a simple java app to see the difference VM settings make on initial metaspace consumption. Committed space, used in brackets:
Notes:
(a) Since JEP-387, with CDS=on, we pay very little committed footprint upfront (384K). For comparison, JDK 15 commits here 5.75M.
(b) The seemingly high difference between Xint and C1+C2 - 11K vs 178K - is misleading: All initial classes get compiled, but since most of their metadata live in CDS, not in Metaspace, all we allocate at the start are MethodCounters. Hence, with -Xint, we almost allocate nothing. That changes as soon as we start loading application classes.
Conclusions:
Proposal:
I propose to make MetaspaceSize independent from compiler. For one, if the intention was to have a lower threshold with compilers deactivated, that has never worked. E.g. on 64bit we always had a threshold of 20.75MB regardless of Xint/TieredStopAtLevel. Even if it worked, the compiler does not make that much difference in metaspace footprint.
I propose to slightly lower MetaspaceSize - on 32bit from 16M to 14M, on 64bit from 20.75M to 20M. This takes the slightly lower metaspace footprint since JEP 387 into account (less waste) and the scale I found to be higher than 1.3.
This is all very cautious. For the standard VM, very little changes, so this is mainly a cleanup patch. We could probably tune MetaspaceSize down to much lower levels. And/or make size it differently depending on UseSharedSpaces. However, atm I don't have time to hunt regressions due to too early GCs.
Tests: GA, nightlies at SAP
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2675/head:pull/2675
$ git checkout pull/2675