fgysin
fgysin

Reputation: 11923

Java heap: What is limiting maximum old generation capacity?

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:

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.

Upvotes: 2

Views: 2521

Answers (1)

ernirulez
ernirulez

Reputation: 751

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...

Upvotes: 3

Related Questions