jvm startup parameters for trouble shooting

总是忘,然后每次都是现查现用,所以汇总记录下吧:

1.enable heapdump:

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/heapdump.hprof -XX:OnOutOfMemoryError =”sh ~/cleanup.sh”

2.enable remote debug:

-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n

3.enable GC log:
-Xloggc:/logs/`date +%F_%H-%M-%S`-gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCCause
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M

4.enable JMX:
-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=8091 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.password.file=/conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=/conf/jmxremote.access

5.enable Jprofiler:
-agentpath:/opt/jprofiler/bin/linux-x64/libjprofilerti.so=port=8849

6.enable EMMA:
-Demma.rt.control=true -Xverify:none -Demma.coverage.out.file=/opt/codecoverage_emma.ec

发布者

傅, 健

程序员,Java、C++、开源爱好者. About me

发表评论