Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
None
Description
There is a regression between redhat-openjdk-18/openjdk18-openshift:1.5-14 and redhat-openjdk-18/openjdk18-openshift:1.5-14.1539812388 wrt how the java behaves during s2i builds.
Having the following test in the maven project, the initial and max heap sizes are significantly larger than they used to be:
28631367680.0 / 4642045952.0 = 6x larger in the new image on this environment.
@Test public void printMemoryUsage() throws IOException { final long totalMemory = Runtime.getRuntime().totalMemory(); final long initialHeapMemory = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit(); final long maxHeapMemory = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax(); File f = new File("/sys/fs/cgroup/memory/memory.limit_in_bytes"); BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f))); String line = br.readLine().trim(); br.close(); System.out.println(String.format("/sys/fs/cgroup/memory/memory.limit_in_bytes = %s", line)); System.out.println(String.format("MAVEN_OPTS=%s", System.getenv("MAVEN_OPTS"))); System.out.printf("HeapMemoryUsage: %s\n", ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()); System.out.printf("NonHeapMemoryUsage: %s\n", ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage()); for (MemoryPoolMXBean mpBean: ManagementFactory.getMemoryPoolMXBeans()) { System.out.printf("%s %s: %s\n", mpBean.getType(), mpBean.getName(), mpBean.getUsage()); } }
With redhat-openjdk-18/openjdk18-openshift:1.5-14 the following is output in the build logs:
/sys/fs/cgroup/memory/memory.limit_in_bytes = 92233720365056
MAVEN_OPTS= -XX:+UseParallelOldGC -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:+ExitOnOutOfMemoryError -XX:+PrintFlagsFinal
HeapMemoryUsage: init = 327155712(319488K) used = 54554728(53276K) committed = 106954752(104448K) max = 4642045952(4533248K)
NonHeapMemoryUsage: init = 2555904(2496K) used = 47650088(46533K) committed = 49020928(47872K) max = 452984832(442368K)
Non-heap memory Code Cache: init = 2555904(2496K) used = 14931072(14581K) committed = 15204352(14848K) max = 251658240(245760K)
Non-heap memory Metaspace: init = 0(0K) used = 29490464(28799K) committed = 30277632(29568K) max = 104857600(102400K)
Non-heap memory Compressed Class Space: init = 0(0K) used = 3265952(3189K) committed = 3538944(3456K) max = 96468992(94208K)
Heap memory PS Eden Space: init = 81788928(79872K) used = 38827840(37917K) committed = 81788928(79872K) max = 1713373184(1673216K)
Heap memory PS Survivor Space: init = 13631488(13312K) used = 6833312(6673K) committed = 13631488(13312K) max = 13631488(13312K)
Heap memory PS Old Gen: init = 218103808(212992K) used = 8893576(8685K) committed = 11534336(11264K) max = 3481272320(3399680K)
The output with redhat-openjdk-18/openjdk18-openshift:1.5-14.1539812388
/sys/fs/cgroup/memory/memory.limit_in_bytes = 92233720365056
MAVEN_OPTS= -XX:+UseParallelOldGC -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:+ExitOnOutOfMemoryError -XX:+PrintFlagsFinal
HeapMemoryUsage: init = 2147483648(2097152K) used = 188946248(184517K) committed = 651689984(636416K) max = 28631367680(27960320K)
NonHeapMemoryUsage: init = 2555904(2496K) used = 47704656(46586K) committed = 48955392(47808K) max = 452984832(442368K)
Non-heap memory Code Cache: init = 2555904(2496K) used = 15024768(14672K) committed = 15138816(14784K) max = 251658240(245760K)
Non-heap memory Metaspace: init = 0(0K) used = 29456808(28766K) committed = 30277632(29568K) max = 104857600(102400K)
Non-heap memory Compressed Class Space: init = 0(0K) used = 3268944(3192K) committed = 3538944(3456K) max = 96468992(94208K)
Heap memory PS Eden Space: init = 537395200(524800K) used = 169133216(165169K) committed = 537395200(524800K) max = 10558111744(10310656K)
Heap memory PS Survivor Space: init = 89128960(87040K) used = 0(0K) committed = 89128960(87040K) max = 89128960(87040K)
Heap memory PS Old Gen: init = 1431830528(1398272K) used = 19813032(19348K) committed = 25165824(24576K) max = 21473787904(20970496K)
The openshift cluster is a homogenous cluster with with about 20GB of memory on each node.