Monitoring Tomcat with Java VisualVM

本文介绍如何利用VisualVM这款免费且强大的Java监控工具来监控Tomcat应用服务器。通过简单的配置,可以实现本地及远程JVM上的Tomcat监控,包括性能指标、线程状态等,帮助开发者快速定位问题。

 

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.

下载代码方式:https://pan.quark.cn/s/a4b39357ea24 HTML大屏展示模板是一种用于设计具有视觉冲击力且内容充实的巨型显示屏应用的设计方案,其应用范围广泛,涵盖了数据分析、监控以及决策支持等多个领域。这些模板通常整合了HTML、CSS、JavaScript等多种技术,尤其借助ECharts等数据可视化工具以达成复杂数据的图形化呈现。以下是对相关技术细节的深入说明: 1. **可视化**:数据可视化是将抽象的数据转化为直观的图像或图表的技术手段。这种技术有助于迅速识别数据中的模式、发展趋势和异常情况,使得非专业背景的人员也能轻松理解复杂的数据信息。在大屏展示场景中,可视化通常包含折线图、柱状图、饼图、热力图、地图等多种图表形式。 2. **大数据**:大数据指的是规模庞大、增长迅速、种类多样且数据密度较低的数据集合。在HTML大屏展示中,大数据的应用旨在支持实时或近乎实时的决策制定,例如监控销售业绩、交通流量、能源消耗等关键性能指标。 3. **HTML**:超文本标记语言(HTML)构成了网页内容的基础结构,用于界定页面的布局和元素。在大屏展示模板中,HTML负责构建页面组件,例如标题、段落、图像以及图表容器等。 4. **CSS**:层叠样式表(CSS)用于调控网页的视觉风格和布局结构。在大屏模板设计中,CSS扮演着核心角色,确保设计的响应性、适应性和美观度,包括设定颜色、字体、间距、动画效果等。 5. **ECharts**:ECharts是由百度研发的一款开源JavaScript数据可视化库,能够支持多种图表类型,如折线图、柱状图、散点图等,并提供了丰富的交互特性。在大屏展示中,ECharts能够助力生成动态且交互式的数据...
内容概要:本文提出了一种基于递进事件触发框架的孤岛微电网DoS攻击容错二次协同控制方法,旨在解决通信资源受限与网络安全威胁耦合下的控制难题。该方法通过设计递进式事件触发机制,在保障系统动态性能的同时显著降低通信频率,减轻网络负载,并有效抵御拒绝服务(DoS)攻击对控制链路的干扰。结合二次协同控制策略,实现了在攻击发生时对微电网频率与电压的精准恢复,同时确保各分布式电源间的功率精确分配与电能质量稳定。通过Simulink搭建的仿真模型验证了该方法在不同攻击强度和通信约束条件下的有效性、鲁棒性与容错能力。; 适合人群:从事电力系统自动化、微电网控制、分布式能源系统、网络物理系统安全及智能电网弹性控制研究的研究生、科研人员和工程技术人员。; 使用场景及目标:①研究孤岛微电网在面临DoS攻击时的弹性控制与容错机制;②设计具有高通信效率和强安全韧性的能源互联网控制系统;③实现微电网二次控制中通信资源优化、控制性能提升与网络安全防护的多目标协同。; 阅读建议:此资源侧重于控制算法的理论设计与仿真验证,建议读者结合Simulink模型深入理解递进事件触发机制与协同控制策略的实现逻辑,重点关注系统在不同攻击场景下的动态响应特性与稳定性表现,以全面掌握其容错性能与工程应用潜力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值