`
solon.jar
  • 浏览: 44766 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

Monitoring Tomcat with Java VisualVM

阅读更多

 

Monitoring Tomcat with Java VisualVM

One of the best kept secrets that's bundled with your Java 6 JDK is VisualVM. VisualVM is an absolutely fantastic, free monitoring tool for Java that you may not realize is right under your nose.

In a nutshell, when you fire up VisualVM it provides you with a ton of monitoring tools for everything running on the JVM. By default VisualVM will monitor the VM from which it's launched, so if for example you launch VisualVM from the bin directory of jdk1.6.0_17, then anything using that JVM will show up as a process in VisualVM that can be monitored. Note that in some cases certain processes will not appear in VisualVM, which is the real point of this post; I'll get to that in a moment.

I'm attaching a few screenshots to this post. The first shows what VisualVM looks like when I fired it up just now on my Linux laptop, the second shows a snapshot of the main monitor screen (in this case I'm monitoring Tomcat), and the third shows a snapshot of the thread monitoring screen (note the Open BlueDragon threads!). VisualVM can also take and load snapshots so you really hone in on problems at the VM level quite easily.

One major point I'd like to make is that VisualVM will monitor any Java application running on the JVM. So in the CFML world this means if you have OpenBD, Railo, or ColdFusion running, they can all be monitored quite nicely using VisualVM.

VisualVM can also monitor remote JVMs via JMX (Java Management Extensions), so if you're having trouble on a remote server and want to see what's going on, as long as the JMX ports are open and accessible you can launch VisualVM from your local machine and connect to the remote VM. Note that monitoring is a very lightweight process so VisualVM can be used to monitor production servers with virtual no impact. Visual VM also does profiling, however, which is a much more heavyweight process. It provides a huge amount of useful information, but should be used only when absolutely needed on production servers since it will have a noticeable impact on performance.

Now to the real point of this post. When I launched VisualVM on a Windows 2003 server today I was surprised that Tomcat didn't show up as a process running under the VM. Turns out that if you install Tomcat as a service, even if it's running under the same user account that you used to launch VisualVM, Tomcat won't appear by default in the VisualVM process list.

Luckily it's easy enough to resolve. Simply open the Tomcat Configuration application and add the following in the Java Options box on the Java tab:

-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
 -Dcom.sun.management.jmxremote.authenticate=false

After making this change you do have to restart Tomcat.

This will enable JMX in Tomcat and allow VisualVM to connect to it. You can choose any port you like, and note that if you want to use SSL or authentication you would set those options to true. I haven't personally messed with authentication so I'm not sure what that authenticates against, but know that if you want to have JMX available on a production system that you can secure it this way, or of course through firewall rules.

With JMX enabled in Tomcat you then go into VisualVM, add a new JMX connection, and point it to localhost:8086 (or whatever port you set JMX to run on). That's it--you're now monitoring Tomcat!

VisualVM is a great, free tool that you likely already have on your machine, so you really owe it to yourself to check it out.

分享到:
评论

相关推荐

    Monitoring Apache Tomcat with JMX.pdf|Monitoring Apache Tomcat with JMX.pdf

    "Monitoring Apache Tomcat with JMX" 是一种利用Java管理扩展(Java Management Extensions, 简称JMX)来实现这一目标的方法。JMX是一种标准的API,允许我们管理和监控Java应用程序,包括Tomcat,获取各种运行时...

    Java内存监控工具Java VisualVM

    Java内存监控工具Java VisualVM

    Java VisualVM gc工具

    Java VisualVM是一款强大的Java应用程序性能分析工具,由Oracle公司提供,它是JDK的一部分。这款工具集成了多种功能,包括内存分析、线程分析、CPU剖析、JVM配置信息查看等,其中GC(Garbage Collection)插件是其...

    Tomcat与Java.Web(源文件)

    14. **Tomcat监控**:使用JMX(Java Management Extensions)和监控工具(如VisualVM、JConsole)可以实时查看Tomcat运行状态,包括内存、线程、请求统计等。 15. **性能测试与调优**:使用Apache JMeter、...

    java VisualVM之插件TAD

    Java VisualVM是一款强大的Java应用程序性能分析工具,它包含了许多功能,如内存分析、线程分析、JMX连接、采样器等。而TAD(Thread Analysis and Dump)是VisualVM的一个插件,专为了解析和分析Java应用程序的线程...

    JavaVisualVM可视化多线程监控分析工具v1.3.8官方安装版

    Java VisualVM是一个多线程的监控分析工具,VisualVM 是一款免费的\集成了多个 JDK 命令行工具的可视化工具,它能为您提供强大的分析能力,对 Java 应用程序做性能分析和调优。功能包括内存分析、快照功能、转储功能...

    tomcat 解决Java heap space问题

    标题中的“tomcat 解决Java heap space问题”指的是在运行Apache Tomcat服务器时,由于Java应用程序内存分配不当或资源消耗过大导致的“Java heap space”错误。这个问题通常出现在Java虚拟机(JVM)试图为对象分配...

    visualvm 中文版

    VisualVM是一款强大的Java应用程序性能分析工具,由Oracle公司开发并提供。它集成了多种功能,使得开发者能够深入了解JVM(Java虚拟机)的行为,优化应用性能,定位内存泄漏,并进行线程和内存分析。这款工具的中文...

    jvisualvm远程访问Linux环境中tomcat

    jvisualvm 是一个功能强大且功能丰富的 Java 监控和 profiling 工具,它可以远程访问和监控 Java 应用程序,包括 Tomcat 应用服务器。下面将详细介绍如何使用 jvisualvm 远程访问 Linux 环境中的 Tomcat。 jdk 的...

    net-java-btrace-visualvm.nbm

    net-java-btrace-visualvm.nbm java visualvm btrace 插件

    tomcat9监控jar包,catalina-jmx-remote java-visualVM专用

    tomcat9监控jar包,catalina-jmx-remote java-visualVM专用

    tomcat8监控jar包,catalina-jmx-remote java-visualVM专用

    tomcat8监控jar包,catalina-jmx-remote java-visualVM专用

    VisualVM_142 For Mac

    VisualVM 是一个工具,它提供了一个可视界面,用于查看 Java 虚拟机 (Java Virtual Machine, JVM) 上运行的基于 Java 技术的应用程序(Java 应用程序)的详细信息。VisualVM 对 Java Development Kit (JDK) 工具所...

    visualvm eclipse 插件

    VisualVM 提供在 Java 虚拟机 (Java Virutal Machine, JVM) 上运行的 Java 应用程序的详细信息。在 VisualVM 的图形用户界面中,您可以方便、快捷地查看多个 Java 应用程序的相关信息。

    tomcat以及Java开发软件

    此外,持续集成工具如Jenkins,版本控制系统如Git,以及性能监控工具如VisualVM也是Java开发中常见的软件。 在提供的压缩包子文件列表中,`apache-tomcat-5.5.27.exe`是Apache Tomcat的一个早期版本的安装程序,...

    Visualvm 基于JAVA的CPU硬件资源管理器源程序.rar

    VisualVM是一款强大的Java性能分析工具,由Oracle公司开发并维护,它是Java开发者的重要辅助工具,尤其在优化应用程序的性能方面。VisualVM集成了多种监视和诊断功能,包括JVM(Java虚拟机)性能监控、线程分析、...

    Java VisualVM监控远程JVM(详解)

    下面小编就为大家带来一篇Java VisualVM监控远程JVM(详解)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    Java程序性能分析工具 VisualVM_202.zip

    VisualVM是一个集成多个JDK命令行工具的可视化工具。可以作为Java应用程序性能分析和运行监控的工具。开发人员可以利用它来监控、分析线程信息,浏览内存堆数据。系统管理员可以利用它来监测、控制Java应用程序横跨...

    visualvm中文版

    VisualVM是一款强大的Java虚拟机(JVM)监控和分析工具,由Oracle公司开发并提供,是Java开发者进行性能调优的得力助手。它集成了多种功能,包括内存分析、线程检查、CPU使用率监控、类加载和垃圾回收查看等,能够...

    最新版windows visualvm_20.zip

    VisualVM是一款强大的Java性能分析工具,由Oracle公司开发并维护,它是Java开发者的重要辅助工具之一。在Windows平台上,VisualVM提供了直观的用户界面,帮助开发者深入理解Java应用程序的运行情况,包括内存使用、...

Global site tag (gtag.js) - Google Analytics