PLEASE NOTE: Getting thread dump and heap dump are stop the world operations.
How to get thread dump
- Confirm the server isn’t getting more requests
- Either detach from application load balancer or block from getting new requests
- Get java process ID using
jps
- Use
jstack to get thread dump file
jstack -l $PID >> threaddump.log
- Analyze from https://fastthread.io/
How to get heap dump
- Confirm the server isn’t getting more requests
- Either detach from application load balancer or block from getting new requests
- Get java process ID using
jps
- Use
jmap to get heap dump file
jmap -dump:format=b,file=headump.hprof $PID
- (Recommended) Zip the .hprof file into .tar.gz
- Analyze from MAT(Eclipse Memory Analyzer) or https://heaphero.io or https://www.yourkit.com/
How to generate gc.log
- To generate gc.log, need to add JVM start-up arguments
- Analyze from https://gceasy.io/
-verbose:gc -Xloggc:${LOG_PATH}/gc/gc.`date '+%Y%m%d%H%M'`.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps
How to make a file into .tar.gz file
tar -zcvf [FILE_NAME.tar.gz] [FILE_NAME]
ex) tar -zcvf aaa.tar.gz abc
tar -cvf [FILE_NAME.tar] [FILE_NAME]
ex) tar -cvf aaa.tar abc
Leave a comment