- 浏览: 1579478 次
- 性别:
- 来自: 厦门
文章分类
- 全部博客 (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 7293注意: 康虎云报表组 ... -
让ie6 7 8 9支持html5 websocket
2016-12-23 20:52 2198结果: 从github上的 web ... -
Sql注入之sqlmap+dvwa实例演练
2016-10-27 16:27 1486Sql注入之sqlmap+dvwa实例演练 相信 ... -
ODOO9 SAAS 全自动安装脚本 基于Ubuntu 14.04 LTS
2016-05-09 10:37 2427install-odoo-saas.sh #! ... -
基于 HTTP/2 的 WEB 内网穿透实现(转)
2016-04-22 15:50 1436基于 HTTP/2 的 WEB 内网穿透实现 HTTP ... -
搭建自己的ngrok服务(转)
2016-04-22 15:42 825搭建自己的ngrok服务 在国内开发、企业号 ... -
一个把内网端口映射到外网的工具ngrok(类似与花生壳)
2016-04-22 14:35 1407Secure tunnels to localhost ... -
申请Let's encrypt的免费SSL证书的正确姿势(转)
2016-03-30 19:16 1325申请Let's encrypt的免费SS ... -
Mybatis Generator配置详解(中文)_转
2015-12-17 16:44 870来自: http://www.jianshu.com/p/e ... -
通过 HTTP 头进行 SQL 注入(转)
2015-12-11 10:10 3190在漏洞评估和渗透测试中,确定目标应用程序的输入向量是 ... -
采用ajp代理模式配置Apache+tomcat实现负载均衡(转)
2015-11-13 10:22 815这一种方法,配置简单,性能也高。附AJP介绍: AJP ... -
使用AXIOM给WebService调用增加SOAP头
2015-05-19 10:17 1103直接上代码 public static void ... -
Weblogic8官方文档有关JMX部分的地址
2013-12-04 14:48 717http://docs.oracle.com/cd/E13 ... -
weblogic server支持P3P协议
2013-10-16 19:34 778weblogic 支持P3P 隐私协议 来源:http:/ ... -
weblogic通过代理插件weblogic.servlet.proxy.HttpProxyServlet跨域访问导致session丢失问题的解决(转)
2013-10-16 19:24 1295原文:http://ribbonchen.blog.163. ... -
一个PHP的开源流媒体服务系统(PHP Webcam Live Streaming)
2013-05-31 18:48 3438http://sourceforge.net/proj ... -
Spring MVC 与 Jython的联姻
2013-05-31 17:21 1225Jython Spring MVC Controllers ... -
排名最前的6款开源ERP软件比较
2013-03-20 22:45 1345为何选择OpenERP而不是 ... -
WP-Table Reloaded插件的数据存储位置
2012-12-30 09:14 1188WordPress插件WP-Table Reloaded数据于 ... -
虚拟化、云计算、开放源代码及其他 (转)
2012-10-19 21:29 1057借国庆长假的机会写了这篇长文,全面地整理了个人从虚拟化 ...
相关推荐
介绍通过Jconsole工具对Java的应用进行监控
使用jconsole远程监控tomcat jmx 实验操作详细信息,本人实验实操
性能监控JConsole远程监控Tomcat服务
jconsole监控堆内存
Jprofile资料——使用JConsole实现JBoss性能监控Jprofile资料——使用JConsole实现JBoss性能监控Jprofile资料——使用JConsole实现JBoss性能监控
JConsole监控JVM
jconsole监控工具配置安装说明 1.tomcat需要添加的参数配置,主要是开启远程监控端口 2.jdk环境变量配置 3.运行监控工具,图形化详细介绍如何配置远程监控 本文档是针对客户实际生产环境而写,配置过程中遇到了一些...
使用Jconsole对java的内存使用情况(JVM)进行监控参照.pdf
jconsole使用手册中文版,详细描述了如何配置使用jconsole进行java程序的性能监控
linux下tomcat优化设置最大连接数内存jconsole监控.docx
JConsole是一个基于JMX的GUI工具,用于连接正在运行的JVM,不过此JVM需要使用可管理的模式启动。如果要把一个应用以可管理的形式启动,可以在启动是设置com.sun.management.jmxremote。JConsole能够提供被监控虚拟机...
如果初次接触JConsole,应该会很有用的!
使用Jconsole对java的内存使用情况(JVM)进行监控
使用Jconsole对java的内存使用情况(JVM)进行监控.pdf
介绍了如何使用JConsole分析JVM,一步一步使用JConsole
NULL 博文链接:https://xiaotao-2010.iteye.com/blog/1460209
NULL 博文链接:https://myhearsnow.iteye.com/blog/1851119
jconsole.jar下载
JVM性能监控工具VisualVM Jconsole插件所需jar包 JTop.jar 点击'JConsole Plugins'按钮 点击'Add JAR/Folder'按钮, 添加JDK_HOME/demo/management/JTop/JTop.jar7)重新打开监控页面,可以看到JConsole