2

I am investigating performance problems on an EE application which are probably a result of a less than optimally tuned garbage collector.

While looking into jstat logs I gathered under heavy load I stumbled upon the following finding:

S0     S1     E      O      P
7.39   0.00   41.81  88.89  53.93

NGCMN     NGCMX     NGC       S0C      S1C   
131072.0  301056.0  301056.0  30080.0  30080.0 

EC        OGCMN      OGCMX       OGC      
240896.0  1441792.0  2058240.0   2058240.0

As per the official jstat documentation here we can see that the current old generation size (OGC) has reached the maximum old generation size (OGCMX). The first line however tells us that "Old space utilization as a percentage of the space's current capacity" (O) is "only" at 88%.

My questions are:

  • What mechanic is setting the old generation limit seeen as OGCMX in the jstat output?
  • What is keeping old space from growing and using up the remaning ~12% of heap?

We have JVM parameters which are setting the min/max for total heap, new space and perm space (-Xms -Xmx -XX:NewSize -XX:MaxNewSize -XX:PermSize -XX:MaxPermSize). But there are no limits set on old space (I don't know if such parameters even exist).


Edit concerning NewRatio:
It is my understadning and also mentioned here that the JVM does not enforce the ratio between new and old space, especially not if the MaxNewSize param is used. And the MaxNewSize param is accepted, as the value above (301056.0KB) is in fact exactly the 294MB we are specifying for MaxNewSize. Furthermore, the default value for NewRatio is 2 (see here), which is not at all the ratio between any of the above values listed by jstat.

Community
  • 1
  • 1
fgysin
  • 11,329
  • 13
  • 61
  • 94
  • These questions have been asked many times on Stackoverflow, a quick search will pop up a lot of information both here and on google. That said, I recommend taking a look at jclarity.com, their gc log scrapper is very valuable for helping to tune the GC settings. – Chris K Sep 15 '14 at 08:53
  • possible duplicate of [Are ratios between spaces/generations in the Java Heap constant?](http://stackoverflow.com/questions/15428227/are-ratios-between-spaces-generations-in-the-java-heap-constant) – Uwe Plonus Sep 15 '14 at 08:57
  • I don't agree on the duplicate. I have read the linked question and many of the related resources. But from what I gathered (see the linked question) there is _no_ fixed ratio between young and old gen size maintained, thus there should not be a old gen size limit just because an explicit young gen size limit is set. – fgysin Sep 15 '14 at 09:08
  • @ChrisK: I am using Censum from jClarity, it is what essentially pointed me in the right direction in the first place. – fgysin Sep 15 '14 at 09:20

1 Answers1

3

I find this question really important. I was looking exactly for the same answer. In my case it's even worse. We have 6GB as Xmx, and the output of gccapacity option shows that it is using almost 100% of the memory:

[ec2-user@ip ~]$ sudo jstat -gccapacity 2416
OGCMX: 6121088.0
OGC:   6084776.0

And the output of the gcutil option:

[ec2-user@ip ~]$ sudo jstat -gcutil 2416
  S0     S1     E      O      P     YGC 
  0.00 100.00  26.01  58.81  59.90   8555

Which means that it should be only using around 59% of the old generation. I don't understand this. This means that the JVM is taking the full capacity even if it is not using it...

ernirulez
  • 671
  • 1
  • 9
  • 20