3

I need to setup a Oracle Glassfish Server and after some research I came up with a configuration that I would like to propose. Any suggestions and/or corrections are very welcome.

My Hardware/OS (relevant) details:

  • Ubuntu 12.04 LTS 64bits
  • JDK 7.0.28
  • RAM 12GB
  • 4 Processors (with 6 cores each)

My JVM Options

  • -server
  • -Xms9g
  • -Xmn1g (Q1)
  • -Xmx9g
  • -Xss128k (Q2)
  • -XX:+UseCompressedOops
  • -XX:+DisableExplicitGC
  • -XX:+UseConcMarkSweepGC
  • -XX:ParallelGCThreads=18
  • -XX:+UseParallelOldGC
  • -XX:SurvivorRatio=8 (Q3)
  • -XX:MaxTenuringThreshold=15 (Q4)
  • -XX:MaxPermSize=1g (Q5)
  • -XX:PermSize=512m

Q1 - Some suggest a 33% (-XX:NewRatio=3) ratio which would result in a 3g Eden. Wouldn't that be a too large space for the GC (with its 18 threads) to clean?

Q2 - I Couldn't find a good value for that.

Q3 - That's the default ratio. Some say that this options doesn't change performance.

Q4 - Same as Q3.

Q5 - No idea of what would be a good value for that.

1 Answer 1

1

You should add JVM/GC logging options, this will allow you to track the GC activities and will help you with determining the optimal values for Q1, Q3, Q4, Q5. Further, GC logging has almost no overhead so you can safely use it in production environment:

JVM/GC logging enabled for example by : -XX:+PrintTenuringDistribution -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=jvm.log -XX:+HeapDumpOnOutOfMemoryError -Xloggc:gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -showversion

Q1 : 3GB is not too large YounGen size if you consider that the total Heap size is 9GB. You need to check the GC logs to see what is the optimal size.

Q2 : This is probably sufficient, you can also test -Xss256k.

Q3 : The -XX:SurvivorRatio option is ignored unless you use -XX-UseAdaptiveSizePolicy, that's why people do not see effects of this option. Consider also -XX:InitialSurvivorRatio=3 and -XX:TargetSurvivorRatio=90. But be careful about disabling the adaptive sizing and do that only if yo u know what you are doing.

Q4 : Thsi is a correct value although I have not see it taking the effect. The GC may decide to promote the objects earlier. Use -XX:+PrintTenuringDistribution to monitor this.

Q5 : You can determine this from the GC logs which will show you the PermGen occupation.

Additional parameters that you could consider:

  • -XX:+AggressiveOpts
  • -XX:+PrintClassHistogramBeforeFullGC -XX:+PrintClassHistogramAfterFullGC for debugging GC issues
  • -XX:-UseBiasedLocking - disabling Biased Locking is usually recommended for Application Servers
  • -XX:+UseLargePages - this will help your performance but you need to configure this in the OS as well.

Some useful tips can be found in the Java Performance book.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .