My GC logs look like this:
2015-11-05T18:49:55.230+0100: 4.337: [GC [PSYoungGen: 387072K->27583K(451584K)] 387072K->27655K(1483264K), 0.2037220 secs] [Times: user=2.08 sys=0.09, real=0.20 secs]
2015-11-05T18:49:55.994+0100: 5.101: [GC [PSYoungGen: 414655K->11758K(838656K)] 414727K->11838K(1870336K), 0.1702880 secs] [Times: user=2.13 sys=0.05, real=0.18 secs]
2015-11-05T18:49:57.248+0100: 6.355: [GC [PSYoungGen: 785902K->10671K(838656K)] 785982K->10759K(1870336K), 0.1309270 secs] [Times: user=1.53 sys=0.09, real=0.13 secs]
2015-11-05T18:49:58.271+0100: 7.378: [GC [PSYoungGen: 784815K->10763K(1612800K)] 784903K->10859K(2644480K), 0.1273570 secs] [Times: user=1.52 sys=0.08, real=0.13 secs]
2015-11-05T18:50:00.296+0100: 9.403: [GC [PSYoungGen: 1559051K->10783K(1612800K)] 1559147K->10887K(2644480K), 0.1275350 secs] [Times: user=1.50 sys=0.06, real=0.13 secs]
2015-11-05T18:50:01.853+0100: 10.960: [GC [PSYoungGen: 1559071K->10735K(3122176K)] 1559175K->10847K(4153856K), 0.1431470 secs] [Times: user=1.72 sys=0.06, real=0.14 secs]
2015-11-05T18:50:05.398+0100: 14.505: [GC [PSYoungGen: 3107311K->576K(3123200K)] 3107423K->11081K(4154880K), 0.1928080 secs] [Times: user=2.31 sys=0.05, real=0.20 secs]
2015-11-05T18:50:08.266+0100: 17.373: [GC [PSYoungGen: 3097152K->512K(6220288K)] 3107657K->11153K(7251968K), 0.0060230 secs] [Times: user=0.03 sys=0.01, real=0.01 secs]
As you see, with time there are 2 on-going trends:
- heap allocation grows from 1.4 gb to 7.2 gb without any particular reason
- minor GC frequency falls
This leads to constant growth of memory used by my application and thats what I want to fix. Max HeapSpace is quite big, so looks like JVM will go on with this way until it hits the limit of Heap. But I would like it to stop at some level. Because as you see - the real usage of Heap is not growing, it is constant, and this is exactly what I expect from my application.
I see several ideas how to fix it:
- make minor GC more frequent
- lower YoungGen space part to force minor GC to be more frequent
- decrease total HeapSpace to force minor GC to be more frequent
The problem is that I dont know how can I tune this for ParallelCollector which is selected by JVM for my environment.
To the best of my knowledge ParallelCollector ignores all settings of JVM which may help me with that, only leaving for us to specify high-level MaxGCPauseMillis and GCTimeRatio parameters. I have seen a similair question here and found only params for Serial Collector which is not my case: Encourage the JVM to GC rather than grow the heap?
Looks like the only option I have for ParallelCollector is to lower HeapSpace with Xmx parameter, and thats all!
PS As I have already explained in my question, this topic - Encourage the JVM to GC rather than grow the heap? - relates to Serial Collector of JVM and contains no answers for Parallel Collector. This was explicitly affirmed in the initial description of the topic.