0

A WildFly 10.1.0 server using Java 1.8.0_202 reports their max values for Eden Space and Survivor Space are both -1 (MBean via JMX) and 0 (via SNMP):

MBean

java.lang:type=MemoryPool,name=G1 Eden Space/Usage/max (Long) = -1
java.lang:type=MemoryPool,name=G1 Survivor Space/Usage/max (Long) = -1

SNMP

.1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.13.4 = Counter64: 0
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.13.5 = Counter64: 0

The mismatch between SNMP and MBean has been clarified in this other question.

The Java process is launched with the following options:

-Xms4096m
-Xmx16384m
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=512m
-XX:MinMetaspaceFreeRatio=20
-XX:MaxMetaspaceFreeRatio=50
-XX:+UseG1GC
-XX:MaxNewSize=3584m
-XX:NewSize=3584m
-XX:SurvivorRatio=6

Is correct that configuration?

Why does this happen?

How can it be solved?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Jdamian
  • 3,015
  • 2
  • 17
  • 22
  • 2
    You have linked to a Q&A which answers your question completely. Its answer links to [this documentation](https://docs.oracle.com/javase/1.5.0/docs/api/java/lang/management/MemoryUsage.html#getMax()) and cites the relevant part: “*This method returns -1 if the maximum memory size is undefined.*” before explaining why SNMP reports that -1 as 0. The only remaining question is *why do you mess around with the garbage collector configuration when you don’t understand the impact of these options?* Just specify `-XX:+UseG1GC -Xms4096m -Xmx16384m` (I assume you know what these options do), not more. – Holger Mar 15 '22 at 15:11
  • Hi @Holger. _I do not mess around_ because I have not configured those Java servers. I'm on charge on monitoring them, not configure them. Do you understand the impact of my job? The purpose of this question is understand how the config led to make the max values undefined. – Jdamian Mar 16 '22 at 08:22
  • 2
    No offence intended. Read “you” as plural, i.e. “your company”. Someone decided to add these options and if that person neither, documented the decision nor is available to answer questions about it, it’s kind of messing around. It’s striking that the decision to add these options was made before you (now singular) were assigned the job of monitoring the application, so the decision for these tuning options can’t be the result of this monitoring. The G1GC adapts the new generation size dynamically to meet the `MaxGCPauseMillis` goal, which doesn’t fit the idea of having an absolute maximum. – Holger Mar 16 '22 at 09:27
  • Thank you @Holger. The *dynamic size* for new generation memory spaces makes me realize the need of change on my monitor script, which relies in the max value to display occupation percentage values (for instance, 34%) and accept percentage thresholds in order to raise alerts. The current release of my script raises a warning when the max value is either zero or -1. – Jdamian Mar 16 '22 at 12:12
  • 1
    I don’t think that focusing on these values is helpful. The only relevant numbers are overall used memory and garbage collection pause times. As long as these numbers are fine, all other numbers are just the responsibility of the garbage collection algorithm. Only when there’s an actual problem, digging into details to analyze it makes sense. I know, that contradicts the philosophy of many tools which like to present you tons of statistics to make you feel like commanding a battleship or watching over a nuclear power plant. But in the end, only running fast and having enough memory matters. – Holger Mar 16 '22 at 13:01

0 Answers0