美文网首页
Java远程性能分析

Java远程性能分析

作者: 阿呆少爷 | 来源:发表于2018-12-28 18:25 被阅读25次

JMX

启动命令如下。

java -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.rmi.port=9091 \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.port=9091 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
-Djava.rmi.server.hostname=10.10.10.10 \
-jar xxx.jar
image.png

JMX没法使用VisualGC。

image.png

jstatd

首先配置好policy。

$ cat jstatd.all.policy 
grant codebase "file:${java.home}/../lib/tools.jar" 
{ permission java.security.AllPermission; };

接着在服务器端先启动jstatd。

jstatd -J-Djava.security.policy=jstatd.all.policy \
-J-Djava.rmi.server.hostname=10.10.10.10 \
-J-Djava.rmi.server.logCalls=true

在jvisualvm里面添加好远程主机,就能看到主机上所有的Java进程。

image.png

jstatd看不到CPU的使用情况。

image.png

jprofiler

在远程主机下载好 jprofiler,解压开。启动进程的时候,需要指定libjprofilerti.so的路径。

java -agentpath:./jprofiler10.1.4/bin/linux-x64/libjprofilerti.so=port=8849 \
-jar xxx.jar 

jprofiler最强大,什么都能看到。

image.png image.png

相关文章

网友评论

      本文标题:Java远程性能分析

      本文链接:https://www.haomeiwen.com/subject/biqslqtx.html