How can I find the default MaxPermSize when -XX:+PrintFlagsFinal is not supported?

3.5k views Asked by At

I'm working with a system where a number of jobs, implemented as Java applications, can be started simultaneously. Each job runs in a separate JVM.

Some of these jobs require bigger permgen size than others. However, it is not feasible to allow all jobs to use the maximum value, as the OS memory is limited.

Therefore, I want to specify -XX:MaxPermSize for every job. Currently, the jobs are running without any -XX:MaxPermSize argument, so they must be using the default value. But how can I find out what the default value is?

I have seen Default values for Xmx, Xms, MaxPermSize on non-server-class machines where the accepted answer is to run java -XX:+PrintFlagsFinal, which should output the default values. However, the JVM version I'm running does not support that argument (Unrecognized VM option '+PrintFlagsFinal'). Updating to a newer JVM is not currently an option.

So what are my options for finding the default value?
System information:

> java -version
Java(TM) SE Runtime Environment (build 1.6.0_14-b08) 
Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)

> cat /etc/issue
Welcome to SUSE Linux Enterprise Server 11 SP2  (x86_64) - Kernel \r (\l).

> uname -r
3.0.101-0.7.17-default
1

There are 1 answers

0
Kashyap On BEST ANSWER

Default values for various regions would depend on:

  • Collector being used (which would depend on Java version in case you're specifying it explicitly using CLI args).
  • Sizes of heap etc you have specified using CLI args. GC would distribute the space according to some ratios.
  • Installed (or may be it was available) RAM on the machine.

How to find out:

  • From GC Log files (-Xloggc:gc.log), I would expect that at least in the Full GC logs, GC would report the Perm Gen sizes. See examples at bottom. You can take a representative gc log file and find the max perm gen size from it, and decide based on that.
  • Additional params like PrintFlagsFinal etc. (specific to Java version)

I'll look through the 1.6 options to see if I can find something and update the post, otherwise it's time to upgrade. :-)

Here are 3 examples from different GCs (Metaspace, CMS Perm & PSPermGen is what you're looking for):

2014-11-14T08:43:53.197-0500: 782.973: [Full GC (Ergonomics) [PSYoungGen: 54477K->0K(917504K)] [ParOldGen: 1042738K->367416K(1048576K)] 1097216K->367416K(1966080K), [Metaspace: 46416K->46389K(1091584K)], 0.4689827 secs] [Times: user=3.52 sys=0.07, real=0.47 secs]
2014-10-29T06:14:56.491-0400: 6.754: [Full GC2014-10-29T06:14:56.491-0400: 6.754: [CMS: 96098K->113997K(5242880K), 0.7076870 secs] 735545K->113997K(6186624K), [CMS Perm : 13505K->13500K(51200K)], 0.7078280 secs] [Times: user=0.69 sys=0.01, real=0.71 secs] 
2014-10-29T21:13:33.140-0500: 2644.411: [Full GC [PSYoungGen: 2379K->0K(695296K)] [ParOldGen: 1397977K->665667K(1398272K)] 1400357K->665667K(2093568K) [PSPermGen: 106995K->106326K(262144K)], 1.2151010 secs] [Times: user=6.83 sys=0.09, real=1.22 secs]