Summary
To better control heap memory allocations, three existing flags based on fractions, 1/N for a provided value of N, are deprecated (-XX:MaxRAMFraction=xxx, -XX:MinRAMFaction=xxx and -XX:InitialRAMFraction=xxx) and three new flags based on percentages, from 0.0 to 100.0, are being introduced (-XX:MaxRAMPercentage -XX:MinRAMPercentage and -XX:InitialRAMPercentage).
Problem
Using the -XX:MaxRAMFraction options, we can only set fractional values 1/2, 1/3, 1/4 etc. Customers would like the ability to select larger amounts beyond 1/2 of available RAM. This can be accomplished by setting hard coded amounts using -Xmx but the requesting customer would like this value to be based on the amount of available memory. In the case where 60% of available host RAM is desired the user would like a flag which would allow them to specify 60.
Solution
Deprecate three existing Hotspot flags -XX:MaxRAMFraction=xxx, -XX:MinRAMFaction=xxx and -XX:InitialRAMFraction=xxx) and add three new flags (-XX:MaxRAMPercentage -XX:MinRAMPercentage and -XX:InitialRAMPercentage) which allow floating point values to be used to specify the percentage of available host memory to be used for Max, Min and Initial Heap sizes.
Specification
Here is my proposed patch for the flag name changes:
product(uintx, MaxRAMFraction, 4,
"Maximum fraction (1/n) of real memory used for maximum heap "
- "size")
+ "size. "
+ "Deprecated, use MaxRAMPercentage instead")
range(1, max_uintx)
product(uintx, MinRAMFraction, 2,
"Minimum fraction (1/n) of real memory used for maximum heap "
+ "size on systems with small physical memory size. "
+ "Deprecated, use MinRAMPercentage instead")
+ range(1, max_uintx)
+
+ product(uintx, InitialRAMFraction, 64,
+ "Fraction (1/n) of real memory used for initial heap size. "
+ "Deprecated, use InitialRAMPercentage instead")
+ range(1, max_uintx)
+
+ product(double, MaxRAMPercentage, 25.0,
+ "Maximum percentage of real memory used for maximum heap size")
+ range(0.0, 100.0)
+
+ product(double, MinRAMPercentage, 50.0,
+ "Minimum percentage of real memory used for maximum heap"
"size on systems with small physical memory size")
- range(1, max_uintx)
-
- product(uintx, InitialRAMFraction, 64,
- "Fraction (1/n) of real memory used for initial heap size")
- range(1, max_uintx)
+ range(0.0, 100.0)
+
+ product(double, InitialRAMPercentage, 1.5625,
+ "Percentage of real memory used for initial heap size")
+ range(0.0, 100.0)
The new flags, if specified, will override the deprecated older flags.
- csr of
-
JDK-8186248 Allow more flexibility in selecting Heap % of available RAM
-
- Resolved
-