Summary
Trim the default setting for InitialRAMPercentage
to 0.2%
to better match current hardware memory sizes for Java applications running with default heap sizes.
Problem
When user does not supply -Xms
, GC ergonomics guesses the initial heap size, based on InitialRAMPercentage
(IRAMP), currently set at 1/64 of physical RAM. The 1/64 guess had not changed since the initial load in 2007. This guess made sense back then. Unfortunately, real machines of today come with lots of physical memory, which drives the default initial heap size very high.
The initial heap size drives the startup times, because GCs need to initialize their internal data structures, e.g. remsets, card tables, or even heap memory itself for the initial heap. In worst cases, this adds single-digit millisecond overhead for Serial/Parallel, double-digit millisecond overheads for G1, multi-second overheads for ZGC during the startup. See the RFE for sample performance data.
Solution
Trim the default setting for InitialRAMPercentage
to 0.2%
to better match current memory configurations. This looks like a sweet spot for current configurations:
- On huge 1024G machine, this yields 2G initial heap
- On reasonably sized 128G machine, this gives 256M initial heap
- On smaller 1G container, this gives 2M initial heap
Depending on heap sizing policy a given GC implements, this may cause more GCs to resize the heap to the same "stable" level as before. This is likely not a problem for small out-of-the-box applications that this enhancement targets.
We expect that the impact of this change on long-running applications would be much lower. Most, if not all memory conscious applications set -Xms
explicitly. In that case, IRAMP
setting yields to Xms
.
Specification
See the associated PR:
diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp
index ba29daf2fe1..924c45f137d 100644
--- a/src/hotspot/share/gc/shared/gc_globals.hpp
+++ b/src/hotspot/share/gc/shared/gc_globals.hpp
@@ -288,7 +288,7 @@
"size on systems with small physical memory size") \
range(0.0, 100.0) \
\
- product(double, InitialRAMPercentage, 1.5625, \
+ product(double, InitialRAMPercentage, 0.2, \
"Percentage of real memory used for initial heap size") \
range(0.0, 100.0) \
\
- csr of
-
JDK-8348278 Trim InitialRAMPercentage to improve startup in default modes
-
- Open
-