0

My project is a Spring Boot application(ver=1.5.7.RELEASE, jdk=1.8.0_131) with JVM options: -Xms2048M -Xmx2048M -Xmn768M -XX:MaxMetaspaceSize=256M -XX:MetaspaceSize=256M.

I saw that init heap size is 2G, but max heap size is 1.9G in Spring Admin. How comes the gap? enter image description here

BTW, Metadata space size is 256M, why non-heap only 205.4M? How comes max non-heap size as 1.5G?

Roger.H
  • 343
  • 1
  • 4
  • 18
  • See this (especially the part with the quote from the docs): https://stackoverflow.com/questions/14763079/what-are-the-xms-and-xmx-parameters-when-starting-jvms – Randy Casburn Oct 17 '18 at 03:46

1 Answers1

2

I saw that init heap size is 2G, but max heap size is 1.9G in Spring Admin. How comes the gap?

One of survivor spaces of the heap is always empty and is not included in calculation of the maximum. See this question.

Metadata space size is 256M, why non-heap only 205.4M?

-XX:MetaspaceSize=256M does not set the initial Metaspace size. This is rather a threshold that triggers GC when reached. See JDK-8039867 for details.

How comes max non-heap size as 1.5G?

Non-Heap includes Metaspace (max 256M in your case), Compressed Class space (max 1G by default) and Code Cache (max 240M by default).

apangin
  • 92,924
  • 10
  • 193
  • 247
  • Good point. For this case young generation is 768M and heap total 2G, so each survivor space is 96M. Then max available heap size is about 1.9G. That explains. But I saw only max 1.88G available in Zabbix, whose data source is Spring Metrics. Any idea why? – Roger.H Oct 18 '18 at 03:20