stServer suggested Java arguments

Low GC pause with large memory caches will give the highest performance.

Below are the standard JVM server parameters. 

G1 Garbage Collector

  • -XX:+UseG1GC
    • Turn on the G1 garbage collector. 
  • -XX:MaxGCPauseMillis=250
    • Target a maximum pause time of no more than 250 milliseconds.  

Young Generation

  • -XX:PermSize=256m
    • The size of the permanent size. 
  • -XX:MaxPermSize=256m
    • Set the max and start size of the permanent memory segment. 

DO NOT over tune the G1GC by setting -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=2

Logging Options

  • -verbose:gc
    • Verbosely log the garbage collection. 
  • -XX:+PrintGCDetails
    • Print the GC details
  • -XX:+PrintGCTimeStamps
    • Print the timestamps of when the GC occurred. 
  • -XX:+PrintGCApplicationStoppedTime
    • Print the time that the application was actually stopped. 
  • -XX:+PrintHeapAtGC
    • Print the heap when a full GC

Miscellaneous Options

  • -server
    • Turn on the server compiler
  • -Xss8M
    • Stack size of 8 megs. 
  • -XX:+ExplicitGCInvokesConcurrent
    • When System.gc() is called do not stop the world. Just schedule a background GC. 
  • -XX:-OmitStackTraceInFastThrow
    • Always show the full stack trace for exceptions like NullPointerException
  • -d64
    • Turn on 64 bit JVM

References