- 浏览: 1617339 次
- 性别:
- 来自: 厦门
文章分类
- 全部博客 (603)
- T_java (145)
- T_script&ASP (51)
- T_C/C++ (25)
- T_PowerBuilder (11)
- T_Database (53)
- T_odoo (7)
- T_应用服务器 (50)
- T_专_条形码 (6)
- T_专_负载均衡器 (4)
- T_操作系统 (94)
- T_信息安全 (41)
- T_专_搜索引擎 (14)
- T_L_PHP (58)
- T_L_Delphi (18)
- T_L_.NET、C#、VisualStudio (25)
- T_L_Objective-C (6)
- T_移动开发 (53)
- T_网络 (109)
- T_大数据 (2)
- T_嵌入式 (2)
- T_小众技术 (24)
- T_未分类 (58)
- L_旅游印记 (1)
- L_生活随笔 (48)
- L_中国文化 (18)
- L_户外与生存 (0)
最新评论
-
csbean4004:
不知道哪传来得恶习,发帖子不好好发,故意弄错一些东西,很讨厌
让HTML5支持后置摄像头 -
withthewind:
终于找到一个可以用的了。。。
如何用VBA取得Word文档中的标题前面的序号 -
busbby:
兄弟,无法下载,说文件不完整
一个好用的Outlook ost格式文件转pst文件的工具 -
yijavakevin:
密码啊~解压密码多少?
一个二维条形码组件 -
vipbooks:
你给的那个链接根本无法下载,跳到官网看了下最新版12M,但点下 ...
十步以内完成精细web打印
Using JConsole to Monitor Applications
The Java 2 Platform, Standard Edition (J2SE) 5.0 release provides comprehensive monitoring and management support. It not only defines the management interfaces for the Java virtual machine, but also provides out-of-the-box remote monitoring and management on the Java platform and of applications that run on it. In addition, JDK 5.0 includes the Java Monitoring and Management Console (JConsole) tool. It uses the extensive instrumentation of the Java virtual machine to provide information on performance and resource consumption of applications running on the Java platform using Java Management Extension (JMX) technology. The article describes how JConsole can be used to observe information about an application running on the Java platform. The article first gives an overview of the J2SE 5.0 monitoring and management architecture and how JConsole plugs into the architecture. It then describes how to use JConsole to access several core monitoring and management functionalities provided by the Java platform including:
Architectural Overview
Figure 1 shows the architecture of J2SE 5.0 monitoring and management support. In the 5.0 release, the Java virtual machine (JVM) is highly instrumented for monitoring and management. The platform instrumentation provides information on performance, resource consumption, and the JVM and logging settings of applications running on the Java platform. JMX provides a standard way to instrument the Java runtime environment and applications, and the JMX Remote API allows that instrumentation to be accessed remotely. The instrumentation is accessible through the JMX managed bean (MBean) interfaces, which are registered in the platform MBean server. Applications can also create their own MBeans and register them in the platform MBean server, which can serve as a single point for remote access. A JMX-compliant client, such as JConsole, can connect to the platform MBean server and manage the application (as well as the Java platform) using JMX technology.
Platform Beans
The Java platform provides a set of platform MBeans (Managed Beans) for monitoring and management of the Java virtual machine and the logging facility: <!-- BEGIN VCD8 DATA TABLE COMPONENT -->
An MBean is a managed object that follows the design patterns conforming to the JMX specification. An MBean can represent a device, an application, or any resource that needs to be managed. The management interface of an MBean comprises a set of readable and/or writable attributes and a set of invokable operations. MBeans can also emit notifications when predefined events occur. Each platform MBean has a rich set of attributes and operations such as memory usage, thread CPU usage, garbage collection statistics, and so on. Some might also emit notifications. We will explore a few platform MBeans in the following sections. The JConsole Tool
JConsole is a JMX-compliant GUI tool that connects to a running JVM, which started with the management agent. To start an application with the management agent for local monitoring, set the JDK_HOME/bin/java -Dcom.sun.management.jmxremote -jar JDK_HOME/demo/jfc/Java2D/Java2Demo.jar where To start JConsole, run JDK_HOME/bin/jconsoleA connection dialog box opens, whose Local tab lists any JVMs running on the local system started with the same user ID as JConsole, along with their process ID and class/argument information.
Jconsole can connect to a running JVM in 3 different ways:
When JConsole successfully establishes the connection, it obtains information from the JVM MBeans in the connected JMX agent, and displays the information in the following tabs:
The MBeans tab displays information on all MBeans registered in the target JVM in a generic way. The MBeans tab allows you to access the full set of the platform instrumentation, including those that are not visible in the other tabs. Note that the other tabs present some of the information on the platform MBeans. In addition, you can monitor and manage your application's MBeans using this MBeans tab. Using MBeans Tab to Monitor and Manage MBeans
All platform and application MBeans that are registered in the connected JMX agent can be accessed through the MBeans tab. For example, the Memory MBean is defined as follows:
The Memory MBean contains four attributes:
The Memory MBean supports one operation,
The tree on the left shows the list of all MBeans, organized by their object names. An MBean object name consists of a domain name and a list of key properties. For example, the platform MBeans for the JVM are all grouped under the " When you select an MBean in the tree, its attributes, operations, notifications, and other information are displayed on the right. You can set the value of attributes, if they are writeable (the value is displayed in blue). You can invoke operations displayed in the Operations tab. You can also watch for the notifications emitted by an MBean: by default, JConsole does not listen to any notification emitted by an MBean until you subscribe to it. You can click the "
The Memory tab provides information about memory consumption, memory pools, and garbage collection statistics by accessing the memory system, memory pools, garbage collector MBeans.
The chart shows the memory usage over time, for heap and non-heap memory, and for specific memory pools. The memory pools available depend on the JVM being used. The following list shows the pools for the HotSpot virtual machine.
The Details area shows several current memory metrics:
The bar chart on the lower right shows memory consumed by the memory pools in the JVM. The bar turns red when the memory used exceeds the usage threshold. The usage threshold is one of the attributes defined in the Memory Pool MBean for low memory detection support. A set of methods defined in the MemoryPoolMXBean interface for low memory detection support follows.
Each memory pool may have two kinds of memory thresholds for low memory detection support: a usage threshold and a collection usage threshold. Either one of these thresholds might not be supported by a particular memory pool. The usage threshold is a manageable attribute of a memory pools. It enables the monitoring of memory use with low overhead. Setting the threshold to a positive value enables usage threshold checking for a memory pool. Setting the usage threshold to zero disables usage threshold checking. The default value is supplied by the JVM. A JVM performs usage threshold checking on a memory pool at the most appropriate time, typically during GC and sometimes at allocation time. If the JVM detects that the current memory usage exceeds the usage threshold, it will set the Some memory pools may not support the usage threshold. You can use the Collection usage threshold is a manageable attribute of some garbage-collected memory pools. After a JVM has performed garbage collection on a memory pool, some memory in the pool will still be occupied by reachable objects. The collection usage threshold allows you to set a value to check against the memory usage only after garbage collection. If the JVM detects that the memory usage exceeds the collection usage threshold, it will set the You can use the The usage threshold and collection usage threshold is set in the MBeans tab. For example, select the
When the memory usage of the
As described earlier, the memory system MBean defines a boolean attribute called Verbose that allows you to turn the GC verbose tracing on or off dynamically. The GC verbose traces will be displayed at the location specified at JVM startup. The default location for GC verbose output of the Hotspot virtual machine is To enable or disable the GC verbose tracing, select the Memory MBean and set the Verbose attribute to true or false. Similarly, the class loading MBean also has the Verbose attribute, which can be set to enable or disable class loading verbose tracing.
The Threads tab provides information about threads running in an application.
The Threads list in the lower left lists all the active threads. If you enter a string in the Filter field, the Threads list will show only those threads whose name contains the string you enter. You can get the thread dump of a thread by clicking on the name of a thread in the Threads list. The Threading MBean provides several other useful operations that are not covered by the Threads tab:
To access these additional features, go to the MBeans tab and select the Threading MBean in the MBeans tree. It lists all the attributes and operations for accessing information in the JVM being monitored.
To check if your application has run into a deadlock (for example, your application seems to be hanging), you can invoke the
Once you click on the
For a deadlock situation, you would typically be interested in the stack trace. You can enter the thread ID of a deadlocked thread in the first parameter of the getThreadInfo operation (say,
Double-clicking on the value field of the stackTrace attribute will show a Composite Navigation view that allows you to traverse the stack trace. Figures 13 and 14 show the Composite Navigation view that displays the top and second top frame of the stack trace of
The Threads tab provides a more user-friendly way to look at the stack trace of a thread. You can find the name of the deadlocked threads using the
The Logging MBean defines a
The Logging MBean also supports three operations:
All three operations take a logger name as the first parameter. To change the level of a logger, enter the logger name in the first parameter and the name of the level it should be set to in the second parameter of the
The JDK 5.0 extends the Operating System MBean to include certain OS resource information such as:
When the Operating System MBean in the MBeans tab is selected, you see all the attributes and operations including the platform extension. You can monitor the changes of a numerical attribute over time—for example, the process CPU time—by double-clicking the value field of the attribute.
In addition, the VM tab and the Summary tab provide information on the operating system resources. The SampleTest application being monitored has its own Hello MBean with the object name: com.sun.example:type=HelloIf the CacheSize attribute is changed, the Hello MBean will send a notification. You can use the MBeans tab to manage your application's MBeans, as well as the platform MBeans. For example, you might want to monitor when the CacheSize attribute is changed. You first subscribe to the notifications in the Notification tab. If you change the CacheSize to 300 , you will see one notification sent out.
Summary
The JConsole tool demonstrates the comprehensiveness and ease-of use of the JDK 5.0's monitoring and management features. You can use JConsole to connect to a running Java virtual machine, and then monitor the memory usage and thread activity. You can obtain class-loading information, plus information on the JVM and the operating system. JConsole also gives you a generic way to access MBeans, such that you can access the full set of instrumentation of the Java platform and also manage your application. We described how to access several core monitoring and management functionalities provided by the Java platform through JConsole, including low memory detection, virtual machine verbose tracing, deadlock detection, and logger level control. Related Information
About the Author
Mandy Chung is a Senior Staff Engineer in the Java Serviceability Group at Sun Microsystems. She designed and implemented the JVM monitoring and management interface in JDK 5.0 and led the JConsole development. She holds a masters degree in Computer Science from the University of California, Davis, and a B.S. in Computer Studies from the University of Hong Kong. |
本文原始地址:
http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html
发表评论
-
十步以内完成精细web打印
2017-06-21 11:44 7401注意: 康虎云报表组 ... -
让ie6 7 8 9支持html5 websocket
2016-12-23 20:52 2338结果: 从github上的 web ... -
Sql注入之sqlmap+dvwa实例演练
2016-10-27 16:27 1621Sql注入之sqlmap+dvwa实例演练 相信 ... -
ODOO9 SAAS 全自动安装脚本 基于Ubuntu 14.04 LTS
2016-05-09 10:37 2506install-odoo-saas.sh #! ... -
基于 HTTP/2 的 WEB 内网穿透实现(转)
2016-04-22 15:50 1510基于 HTTP/2 的 WEB 内网穿透实现 HTTP ... -
搭建自己的ngrok服务(转)
2016-04-22 15:42 926搭建自己的ngrok服务 在国内开发、企业号 ... -
一个把内网端口映射到外网的工具ngrok(类似与花生壳)
2016-04-22 14:35 1407Secure tunnels to localhost ... -
申请Let's encrypt的免费SSL证书的正确姿势(转)
2016-03-30 19:16 1391申请Let's encrypt的免费SS ... -
Mybatis Generator配置详解(中文)_转
2015-12-17 16:44 931来自: http://www.jianshu.com/p/e ... -
通过 HTTP 头进行 SQL 注入(转)
2015-12-11 10:10 3277在漏洞评估和渗透测试中,确定目标应用程序的输入向量是 ... -
采用ajp代理模式配置Apache+tomcat实现负载均衡(转)
2015-11-13 10:22 882这一种方法,配置简单,性能也高。附AJP介绍: AJP ... -
使用AXIOM给WebService调用增加SOAP头
2015-05-19 10:17 1164直接上代码 public static void ... -
Weblogic8官方文档有关JMX部分的地址
2013-12-04 14:48 751http://docs.oracle.com/cd/E13 ... -
weblogic server支持P3P协议
2013-10-16 19:34 816weblogic 支持P3P 隐私协议 来源:http:/ ... -
weblogic通过代理插件weblogic.servlet.proxy.HttpProxyServlet跨域访问导致session丢失问题的解决(转)
2013-10-16 19:24 1347原文:http://ribbonchen.blog.163. ... -
一个PHP的开源流媒体服务系统(PHP Webcam Live Streaming)
2013-05-31 18:48 3528http://sourceforge.net/proj ... -
Spring MVC 与 Jython的联姻
2013-05-31 17:21 1270Jython Spring MVC Controllers ... -
排名最前的6款开源ERP软件比较
2013-03-20 22:45 1398为何选择OpenERP而不是 ... -
WP-Table Reloaded插件的数据存储位置
2012-12-30 09:14 1276WordPress插件WP-Table Reloaded数据于 ... -
虚拟化、云计算、开放源代码及其他 (转)
2012-10-19 21:29 1109借国庆长假的机会写了这篇长文,全面地整理了个人从虚拟化 ...
相关推荐
使用Jconsole对Java应用程序进行监控可以实时监控Java应用程序的运行状态,帮助开发者快速定位问题和优化性能。Jconsole提供了多种功能,包括内存监控、线程监控、类装载监控、MBeans监控、虚拟机监控等,可以帮助...
通过以上介绍可以看出,JConsole是一个非常强大的工具,不仅能够帮助我们实时监控JVM的运行状态,还能通过MBean接口实现对系统的深度监控和管理。这对于优化应用性能、提高系统的稳定性和响应速度具有重要意义。特别...
为了能够在客户端上运行jconsole监控工具,还需要在客户端上安装JDK并正确配置环境变量。 **1. 安装JDK** - **步骤:** - 下载最新版本的JDK,例如从Oracle官网下载JDK 6。 - 运行下载的安装程序,完成JDK的安装...
**JConsole监控Tomcat服务详解** 在Java应用服务器如Tomcat的日常运维中,性能监控是必不可少的一个环节。JConsole是Java自带的一款强大的可视化管理工具,它可以用来监控Java应用程序的性能和资源消耗情况,帮助...
#### 四、JConsole监控功能 JConsole提供了丰富的监控功能,包括但不限于: - **内存监控**:显示堆内存的使用情况,包括堆内存的总大小、已使用的大小和剩余空间。 - **线程监控**:展示当前JVM中的线程信息,包括...
总结,利用JConsole监控JBoss性能是Java应用运维中的基础技能,它能帮助我们及时发现问题,提升系统性能。同时,结合JProfiler等专业工具,我们可以进一步深入到代码层面,进行更精细化的性能优化。了解并熟练掌握...
JConsole是一款强大的Java管理控制台,它被包含在JDK中,从1.5版本开始提供,主要用于监控Java应用程序的JVM(Java Virtual Machine)状态。JConsole通过JMX(Java Management Extensions)技术来实现远程管理和监控...
该工具可以帮助开发者和管理员实时监控Java应用程序的运行情况,从而判断出系统的一个大概的性能情况。 jconsole的主要功能包括: 1. 监控Java应用程序的性能,包括CPU使用率、内存使用率、GC频率等。 2. 监控Java...
在Java开发与运维过程中,监控应用程序的性能和资源使用情况至关重要。Java提供了一款强大的可视化监控工具——jconsole.jar,它可以帮助开发者和系统管理员实时查看和分析JVM(Java Virtual Machine)的状态,包括...
一旦配置正确,JConsole 可以为用户提供有关被监控 JVM 的多种信息,包括但不限于内存使用情况、线程状态、类加载统计信息以及 MBean(Managed Bean)的状态等。 自 JDK 5 开始,JConsole 已经成为标准工具集的一...
JConsole是Java开发工具包(JDK)自带的一个强大的、基于Java的图形用户界面(GUI)工具,它允许我们监控Java应用程序的资源使用情况,包括内存、线程、类加载以及JVM的垃圾收集等。本文将详细介绍JConsole及其在...
Ehcache提供了JMX(Java Management Extensions)支持,允许我们通过JMX客户端工具(如jconsole或VisualVM)来监控缓存的大小、命中率、过期情况等关键指标。此外,Ehcache还提供了一个Web管理界面——`Ehcache Web ...
Jconsole通过JMX远程管理功能,允许用户在本地机器上监控远程服务器上的Java应用,这对于分布式系统尤其有用。 要在Linux服务器上启用JMX远程监控,首先需要确保服务器上安装了JDK,并且Java应用程序是以支持JMX的...
JConsole是Java官方提供的一款强大的性能监视工具,它可以帮助我们实时监控Java应用程序的运行状态,包括内存使用、线程状态、类加载、JVM垃圾回收等关键信息。本手册将详细介绍如何有效地使用JConsole进行JVM分析。...
在JDK8中,JConsole是一个强大的可视化工具,它允许开发者实时监控Java虚拟机(JVM)的状态,包括内存使用、线程活动、类加载、虚拟机概要以及管理MBeans等关键信息。 **JConsole工具** JConsole是Java平台的标准...
4. **查看监控数据**:在 JConsole 的“MBeans”选项卡下可以找到 Tomcat 的监控数据,包括但不限于内存使用情况、线程池状态等。 通过上述设置和监控手段,可以有效优化 Tomcat 在 Linux 系统下的性能表现,提高...
以下是如何在CentOS 7.5上配置和使用JConsole来远程监控WebLogic 12c的详细步骤: 1. **环境准备**: - 操作系统:CentOS 7.5 - 应用服务器:WebLogic 12c - JDK版本:1.8 2. **配置WebLogic**: 首先,我们...
`jconsole`是Java开发和运维人员的利器,它是一款由Oracle提供的JDK自带的监控工具,用于监视Java应用程序的性能和资源消耗。通过图形化界面,`jconsole`能够帮助我们实时查看和分析Java虚拟机(JVM)的状态,包括...
JConsole是Java平台自带的一个强大的监控和管理工具,它能够帮助开发者和运维人员实时监控Java应用程序的性能和资源消耗情况。本文将深入探讨JConsole的使用方法及其在优化和排查问题时的重要作用。 首先,我们需要...
例如,若要在本地监控名为`Java2Demo`的应用,则可以使用以下命令启动该应用: ```shell JDK_HOME/bin/java -Dcom.sun.management.jmxremote -jar JDK_HOME/demo/jfc/Java2D/Java2Demo.jar ``` 这里`JDK_HOME`是指...