0
votes

verbose log shows that Full GC occurrence is in every 7 second -

], 7.3933980 secs] [Times: user=89.17 sys=1.16, real=7.39 secs]
79959.910: [Full GC [PSYoungGen: 390144K->194442K(451584K)] [ParOldGen: 1572654K->1572852K(1572864K)] 1962798K->1767294K(2024448K) [PSPermGen: 103569K->103569K(103936K)], 7.9599570 secs] [Times: user=95.28 sys=1.09, real=7.96 secs]
79984.776: [Full GC [PSYoungGen: 390144K->196124K(451584K)] [ParOldGen: 1572852K->1572544K(1572864K)] 1962996K->1768668K(2024448K) [PSPermGen: 103569K->103569K(103936K)], 7.6023130 secs] [Times: user=91.82 sys=1.22, real=7.60 secs]
80007.996: [Full GC [PSYoungGen: 390144K->194969K(451584K)] [ParOldGen: 1572544K->1572734K(1572864K)] 1962688K->1767703K(2024448K) [PSPermGen: 103569K->103569K(103936K)], 8.0980790 secs] [Times: user=98.03 sys=1.28, real=8.10 secs]

I'm using this JVM params with Oracle hotspot 64 bit, RAM size is 30688332 KB and java version 1.7.0_91,on Linux-

-server -Xmx2048m -Xms2048m -XX:NewRatio=3 -XX:MaxPermSize=512m -XX:+UseParallelGC -Djava.awt.headless=true

jstack result show - enter image description here

I've tried to change NewRatio to 2 or 3 and Xmx to

verbose gc logs shows that Old generation is struggling to reallocate memory. What should be the next step? Please suggest!

2
If you need more RAM you need more RAM. Your application either has very memory hungry, or has a memory leak. Start JVisualVM, profile the memory allocations, work out which it is.Boris the Spider
The first step is always to generate a heap dump and figure out what's going on.biziclop
Profile your application, find where allocations occur and reduce them.Jeroen Vannevel
If your machine has 30 GB, the default JVM size would be 1/4 of this. i.e. ~8 GB. Since you have tuned down the amount of memory and it looks like this is not enough, I would try increasing the maximum size or not setting it at all. I would also try removing the NewRatio and set how it runs before setting it again. Note: your Old gen is 99.98% full.Peter Lawrey
Your permgen looks fine as only 103 MB is being used.Peter Lawrey

2 Answers

2
votes

Use available resources wisely.

You are using max memory as 2048MB which I think is fairly less for today's applications. If your application needs more memory and if you have more available memory (I think you have ~30GB) then IMHO, then you should allocate it.

Try such optimizations as last resort. I think you should try doubling your xmx size and then compare results. There is no harm in allocating half of available system memory to your app considering there are no other apps on system.

If increasing memory doesn't work out (because of memory leak) then profile your application using profilers / heap dumps and memory analyzer or static code analyzers.

0
votes

Is your code calling System.gc() anywhere? If so, how often does it get called? I had code that called gc when a big task was completed, but later changes meant it got called much more frequently than expected resulting in spending a lot of time doing useless GC.

The simple fix is to just remove the calls to System.gc() and let the JVM handle it. A clever fix is to call a helper method that checks how long since GC was last called and only calls if sufficient time has passed. This probably isn't needed so just try the simple fix first.