JVM tuning monitoring tools are introduced (jconsole, jmap, jstack)

jconsole remote tomcat process

Modify tomcat / bin / catalina.sh document, to paste the following file catalina.sh 

JAVA_OPTS="-Djava.rmi.server.hostname=192.168.53.53 -Dcom.sun.management.jmxremote.port=11000 -Dcom.sun.management.jmxremote.rmi.port=11000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

 Open jconsole connection tomcat process without entering a user name / password

 jconsole remote jboss process (user name / password can not fill), view memory, threads, classes

In % JBOSS_HOME% \ bin \ run.sh the files  JAVA_OPTS = "$ JAVA_OPTS -Dprogram.name = $ PROGNAME" amended as follows:

 JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME -Dcom.sun.management.jmxremote.port=15080 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

 

jstack -h   查看帮助

jstack是jdk自带的线程跟踪工具,用于打印指定 java进程(如jboss中run.sh配置的15080端口) 的线程堆栈信息   如下pid=15080

jstack -l pid >>jstack.log      用于生成java虚拟机当前时刻的线程快照 (jstack.log 默认就带时间戳)



jmap -h   查看帮助

jmap -histo pid >>jmap.log     打印此刻,堆 内存中所有的对象 和 数量 (jmap.log 默认没带时间戳)

真实应用场景,是写的定时shell脚本,测试人员主要运行脚本, 来定时抓取 快照(包含jstack和jmap),生成一段时间间隔的连续文件

 

 

发布了78 篇原创文章 · 获赞 12 · 访问量 12万+

Guess you like

Origin blog.csdn.net/qq_29883183/article/details/91345005