Java VisualVM使用

Java VisualVM

Java VisualVM官网

Java VisualVM介绍

Java VisualVM is a tool that provides a visual interface for viewing detailed information about Java applications while they are running on a Java Virtual Machine (JVM), and for troubleshooting and profiling these applications. Various optional tools, including Java VisualVM, are provided with Sun's distribution of the Java Development Kit (JDK) for retrieving different types of data about running JVM software instances. For example, most of the previously standalone tools JConsole, jstat, jinfo, jstack, and jmap are part of Java VisualVM. Java VisualVM federates these tools to obtain data from the JVM software, then re-organizes and presents the information graphically, to enable you to view different data about multiple Java applications uniformly, whether they are running locally or on remote machines. Furthermore, developers can extend Java VisualVM to add new functionality by creating and posting plug-ins to the tool's built-in update center.
Java VisualVM can be used by Java application developers to troubleshoot applications and to monitor and improve the applications' performance. Java VisualVM can allow developers to generate and analyse heap dumps, track down memory leaks, browse the platform's MBeans and perform operations on those MBeans, perform and monitor garbage collection, and perform lightweight memory and CPU profiling.
Java VisualVM

Java Visual使用

通过JMX监控远程服务器jvm资源使用情况。
JMX:Java Management Extensions ,即 Java 管理扩展 , 是一个为应用程序、设备、系统等植入管理功能的框架。 JMX 可以跨越一系列异构操作系统平台、系统体系结构和 网络传输协议,灵活的开发无缝集成的系统、网络和服务管理应用。

需要在远程服务器启动java程序(比如Tomcat的catalina.sh)时在JAVA_OPTS中指定如下参数(最后一项参数可选):

-Dcom.sun.management.jmxremote.port=8899 ---配置远程 connection 的端口号,确保该端口没有被占用
-Dcom.sun.management.jmxremote.ssl=false ---指定JMX 是否启用 ssl
-Dcom.sun.management.jmxremote.authenticate=false   ---指定JMX 是否启用鉴权(需要用户名,密码鉴权)
-Djava.rmi.server.hostname=127.0.0.1 ---配置server 的 IP

Java程序启动项设置(追加java visualVM相关配置项):

java -Dcom.sun.management.jmxremote.port=8899 \
     -Dcom.sun.management.jmxremote.ssl=false \
     -Dcom.sun.management.jmxremote.authenticate=false \

Java VisualVM - Connecting to JMX Agents Explicitly

参考文档:

Memory Profiling using Visual VM
Configuring Java JVM Heap Size

转载于:https://www.cnblogs.com/HopkinsCybn/p/10014714.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值