Skip to content

Instantly share code, notes, and snippets.

@yamingd
Last active May 5, 2018 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamingd/6b632c38992a582372b6 to your computer and use it in GitHub Desktop.
Save yamingd/6b632c38992a582372b6 to your computer and use it in GitHub Desktop.
java web server jvm common tuning
-Xms initial java heap size
-Xmx maximum java heap size
-Xmn the size of the heap for the young generation
-XX:PermSize: initial value
-XX:MaxPermSize: max value
It is good practice with server-side Java applications to set the minimum -Xms and maximum -Xmx heap sizes to the same value.
For efficient garbage collection, the -Xmn value should be lower than the -Xmx value.
-server
-XX:+UseConcMarkSweepGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+PrintGCDetails
-XX:+HeapDumpOnOutOfMemoryError
http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html
http://stackoverflow.com/questions/1518213/read-java-jvm-startup-parameters-eg-xmx
@dvayanu
Copy link

dvayanu commented May 5, 2018

The ultimate gc log settings for Java 8:

-Xloggc:logs/gc.log
-XX:+PrintGCDetails
-XX:+PrintTenuringDistribution
-XX:+PrintGCDateStamps
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCApplicationConcurrentTime
-XX:+PrintReferenceGC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment