PS Memory of the old generator in heap memory Usage: GC settings

enter image description here

The following are the JVM settings:

JAVA_OPTS=-server -Xms2G -Xmx2G -XX:MaxPermSize=512M -Dsun.rmi.dgc.client.gcInterval=1200000 -Dsun.rmi.dgc.server.gcInterval=1200000 -XX:+UseParallelOldGC -XX:ParallelGCThreads=2 -XX:+UseCompressedOops -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jbos88,server=y,suspend=n 

Problem: Total heap memory: 2 GB Old general: 1.4 GB (2/3 heaps) New generator: 600 MB (1/3 heaps)

The Old Gen grows in memory beyond 70% of its allocated size and is never exposed to GC even at 100%, i.e. 1.4 GB You can see that the graph is below its peaks and is never a GC; a memory drop occurs when it was forced by a GC with JConsole. This problem ultimately leads to the shutdown of the web server.

Anything I'm missing or mistakenly installing the JVM?

Thanks for the help in advance.

Update my question:

After analyzing the heap, it looks like a bean match session is the main suspect: enter image description here We have a beans state session that stores persistence logic supported by Hibernate.

+6
source share
3 answers

enter image description here The beans state session made the JVM run memoryless. Explicitly handling them using the @Remove annotation resolved this issue.

+3
source

GC will eventually be triggered; the old gene is almost never called (because it is very slow). Gc really works, but it will only work with the new general and the surviving descendant, it has a completely different cleaning algorithm for the old generation, which is slower than the new / surviving one.

These numbers are really high, old age should never reach a large amount compared to the new one. I assume you have a memory leak.

I can only guess that the program deals with large files, you probably keep links to them for a long time.

+4
source

Even if the problem with the main problem (memory leak) is resolved, if you still want the old gene to be cleaned in frequent small pauses, you can try installing

 -XX:MaxGCPauseMillis=(time in millis) 

and this applies only to the Parallel Collector and when the adaptive calibration policy is enabled. An adaptive calibration policy is enabled by default, but if you want to explicitly state this, you can use.

 -XX:+UseAdaptiveSizePolicy 

Or you can switch to the CMS collector, where you can use

 -XX:CMSInitiatingOccupancyFraction=(% value) -XX:+UseCMSInitiatingOccupancyOnly 

This is a more reliable way to collect the old generation when it has reached a certain proportion of the old generation.

+3
source

Source: https://habr.com/ru/post/975206/


All Articles