Skip to content

Instantly share code, notes, and snippets.

@ashishb888
Created September 9, 2019 13:04
Show Gist options
  • Save ashishb888/cdb57dfca3b9b05fbae67365a844245b to your computer and use it in GitHub Desktop.
Save ashishb888/cdb57dfca3b9b05fbae67365a844245b to your computer and use it in GitHub Desktop.
Advanced JVM tuning | JVM profiling
#Garbage Collection Tuning
-server
-Xms10g
-Xmx10g
-XX:+AlwaysPreTouch
-XX:+UseG1GC
-XX:+ScavengeBeforeFullGC
-XX:+DisableExplicitGC
#Getting Heap Dump on Out of Memory Errors
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/path/to/heapdump
-XX:OnOutOfMemoryError=“kill -9 %p”
-XX:+ExitOnOutOfMemoryError
#Detailed Garbage Collection stats
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=100M
-Xloggc:/path/to/gc/logs/log.txt
#FlightRecorder Settings
-XX:+UnlockCommercialFeatures
-XX:+FlightRecorder
-XX:+UnlockDiagnosticVMOptions
-XX:+DebugNonSafepoints
#To start recording for a particular Java process use this command as an example
jcmd <PID> JFR.start name=<recordcing_name> duration=60s filename=/var/recording/recording.jfr settings=profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment