JVM freezes due to infinite GC

I have a huge application running on a Glassfish server that creates many short-lived objects, and I have the following GC configuration in the JVM.

-XX:+DisableExplicitGC -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:-UseAdaptiveSizePolicy -XX:PermSize=256m -XX:MaxPermSize=1024m -Xms7g -Xmx7g -XX:NewRatio=2 

But the JVM hangs with the Infinite GC. I have to restart the JVM. I get the following information from GC Log.

 2.855: [GC 734029K->9736K(7034240K), 0.0133500 secs] 2.869: [Full GC 9736K->9501K(7034240K), 0.1043570 secs] 13.254: [GC 681231K->26506K(7034240K), 0.0251050 secs] 13.280: [Full GC 26506K->26082K(7034240K), 0.2904930 secs] 13.589: [GC 103156K->26224K(7034240K), 0.0015940 secs] 13.590: [Full GC 26224K->24440K(7034240K), 0.2254710 secs] 35.478: [GC 1859512K->131673K(7034240K), 0.0781300 secs] 41.603: [GC 1966745K->351954K(7034240K), 0.1858590 secs] 46.012: [GC 2187026K->502362K(7034240K), 0.2329020 secs] 51.850: [GC 2337434K->608654K(7034240K), 0.2012410 secs] 72.584: [GC 2443726K->727923K(7034240K), 0.2203390 secs] 80.239: [GC 2562995K->894770K(7034240K), 0.2323490 secs] 106.221: [GC 2729842K->1265916K(7034240K), 0.2800630 secs] 

Please let me know if the jvm GC settings are suitable for this use case. Or any help to solve these problems is much appreciated.

Update I also got jmap heap dump information. PS The old generation seems to hold most of the memory, even when no one is using it. It does not increase (what will happen in the event of a memory leak).

 using thread-local object allocation. Parallel GC with 8 thread(s) Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 7516192768 (7168.0MB) NewSize = 5439488 (5.1875MB) MaxNewSize = 17592186044415 MB OldSize = 5439488 (5.1875MB) NewRatio = 2 SurvivorRatio = 8 PermSize = 268435456 (256.0MB) MaxPermSize = 1073741824 (1024.0MB) Heap Usage: PS Young Generation Eden Space: capacity = 2244935680 (2140.9375MB) used = 863166976 (823.18017578125MB) free = 1381768704 (1317.75732421875MB) 38.44951923076923% used From Space: capacity = 112525312 (107.3125MB) used = 47609824 (45.404266357421875MB) free = 64915488 (61.908233642578125MB) 42.31032392071928% used To Space: capacity = 114753536 (109.4375MB) used = 0 (0.0MB) free = 114753536 (109.4375MB) 0.0% used PS Old Generation capacity = 5010817024 (4778.6875MB) used = 4385643424 (4182.475494384766MB) free = 625173600 (596.2120056152344MB) 87.52351967741699% used PS Perm Generation capacity = 458031104 (436.8125MB) used = 432700088 (412.6549606323242MB) free = 25331016 (24.15753936767578MB) 94.46958606549131% used 
+4
source share
3 answers

Is it possible to undo ParallelOldGC? It seems to be causing a piece of memory.

Or you can try adding

-XX: + UseCMSCompactAtFullCollection and -XX: CMSFullGCsBeforeCompaction = 0

You can also add a -server It seems that it is always used for server-side Java applications.

Not sure if this can help. Because I canโ€™t try it for you.

+3
source

Not sure if this helps, but you can use an additional parameter:

  -XX:ParallelGCThreads=10 //10 threads for GC 

to reduce the number of default GC threads.

+1
source

The problem may be that Xmx and Xms are set to the same large 7g value. Why don't you set Xms to a lower value? IMHO, this should be fixed.

0
source

All Articles