jvisualvm

Java VisualVM CPU usage and processor affinity

痴心易碎 提交于 2019-12-04 04:13:29
In my experience today, I find that Oracle's Java VisualVM shows cpu usage as a percent of total machine cores, even when the JVM being monitored has a limited process affinity set in the OS. This is in the "monitor" tab. Limiting the monitored jvm with taskset (on linux, Ubuntu), when the processors allowed to that jvm are near 100% utilization in htop , the cpu percentage shown in VisualVM is clearly equal to the total number of cpus divided by the number of processors allowed to the monitored jvm. The resolution of the scale is therefore inadequate for this case. Can you confirm you

How do you run jvisualvm.exe under the local system account under Windows Server 2008?

我怕爱的太早我们不能终老 提交于 2019-12-03 19:07:08
I've been looking for a comparable approach as posted here for Windows Server 2003 for starting jvisualvm under system account. But I got the error: ...\jdk1.6.0_24\bin\jvisualvm.exe exited on ... with error code -1073741819. I found that jvisualvm is using a configuration file: ...\jdk1.6.0_24\lib\visualvm\etc\visualvm.conf This configuration file contains a default_userdir property that points to ${HOME}/... . The system account seems to have issues with ${HOME} . Changing this parameter and replace ${HOME} with C:/Temp makes the above mentioned solution available for Windows Server 2008 R2

使用JDK进行Performance Tuning

给你一囗甜甜゛ 提交于 2019-12-03 18:44:48
JDK里有三个很好用的工具, jmap , jconsole 和 jvisualvm ,三个工具都各有所侧重,但是如果你的系统遇到性能瓶颈(内存不足或是CPU占用率过高),你可以通过这三个工具来发现应用里的hot spot。我今天只记一下大概的用法,给自己做个备忘,详细的使用说明,等忙完了这段时间,整理一下。 先介绍一个小工具,jps,这也是jdk自带的工具之一,可以列出系统里所有的java进程。 jmap可以查看程序中堆的使用情况,具体的用法是: jmap –histo:live <pid>; 以及可以将堆dump到一个文件,命令是: jmap –dump:format=b,file=heap.bin <pid>; 请在<pid>处填入相应的进程的id。 jconsole可以查看某个java进程的内存使用、CPU占用率等, 如果想要远程查看某一java程序,则需要在该程序启动参数里加下如下参数: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port= 9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false 上文使用的9001是监听的端口号,你可以指定其他的值

Tomcat配置Jconsole , JvisualVm 监控配置

China☆狼群 提交于 2019-12-03 18:44:39
Java内置有jconsole监控工具,可以监控CPU、内存、线程、类加载等信息,但以服务方式启动的tomcat不能被jconsole识别,在网上查找了一通,发现可以通过配置JAVA_OPTS方式启动RMI远程监控接口,能够使用jconsole监控tomcat,把方法记录一下,以供以后备查: 在Tomcat的配置界面中找到Java选项卡,在Java Options框的最下方增加以下内容: -Djava.rmi.server.hostname=172.16.18.155 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port="18081" -Dcom.sun.management.jmxremote.authenticate="false" -Dcom.sun.management.jmxremote.ssl="false" 其中注意 -Djava.rmi.server.hostname=172.16.18.155中的IP地址要写成本机配置的IP,也可以配置成0.0.0.0,不然有可能会导致监听不能正常启动 启动后运行jconsole 在界面中选择远程进程,填写 localhost:18081,用户名和密码为空,点击连接即可 tomcat内存配置: -XX:PermSize=128M -XX

使用JMX透过防火墙远程监控tomcat服务

允我心安 提交于 2019-12-03 18:44:25
JDK的bin目录下有jvisualvm或jconsole可以监控本地和远程jvm实例的运行动态(包括cpu,内存等), 对于性能分析或内存泄露分析等极其方便。下面介绍如何通过这两个工具远程监控有防火墙的linux上的tomcat服务。 废话少说,直接上正题: 我的测试环境是:centos 6.2(IP为192.168.1.118)上通过jsvc将tomcat 7作为服务启动。 1. 下载http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-7/v7.0.28/bin/extras/catalina-jmx-remote.jar并放在tomcat7的$CATALINA_BASE/lib目录。 2. 修改tomcat7的$CATALINA_BASE/conf/server.xml,在<Server port="8005" shutdown="SHUTDOWN"> 下加入监听器: <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" /> 3. 建立文本文件$CATALINA_BASE/conf/jmxremote

使用jvisualvm来远程观察Java程序

不打扰是莪最后的温柔 提交于 2019-12-03 18:44:03
本文为转载学习 原文链接: http://blog.iamzsx.me/show.html?id=394002 这里要介绍的第一种方式是, 使用JMX来进行监控 。 这种方式要求我们 在启动Java程序的时候手动开启jmx remote功能 。开启的方式是使用下面的命令行参数启动Java程序: -Dcom.sun.management.jmxremote.port=<port> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false 这里 <port>是jxm remote使用的端口 。大家可以随意改成自己想要的端口。 假设我们要 在10.2.3.4这台机器上启动一个Java程序foo.jar。那么我们可以使用下面的方式来启动程序。 java -Dcom.sun.management.jmxremote.port=40124 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar foo.jar 在这里我们把端口设置成了40124。 接下来我们 打开jvisualvm ,然后 在Remote上点击右键 ,填上我们要监控的

Better options to view JMX beans other than Jconsole [closed]

六眼飞鱼酱① 提交于 2019-12-03 17:03:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . JConsole has quiet a buggy view to monitor JMX published counters. What are the other alternatives ? I am unable to find any, other than JVisualVM which in effect uses the same view 回答1: Some alternatives are (since I'm fine with JVisulaVM I haven't tried them yet): JRockit Mission Control (will be added as Java

记一次dbcp数据库连接池问题分析

梦想的初衷 提交于 2019-12-03 14:48:21
最开始使用数据库连接池 DBCP 是在公司的项目中,使用 Spring+MyBatis 直接简单的设置了一些参数就拿来用了。因为配置的部分也是其他同事做好的,所以对于 DBCP 也没有深入了解过。 后来帮同学写一点服务器代码,没有用其他任何框架只是使用 DBCP 数据库连接池来管理数据库连接。在这个过程中发现程序直接执行到被挂起,但是程序并没有执行完。 我使用的dbcp数据库连接池的版本是1.x,下图是我依赖的包文件的示意图 图1 dbcp版本 下面的代码只是为了还原问题的情况的代码,这是比较糟糕的代码,请不要在实际中这样写。代码只是使用BasicDataSource获得连接,而不关闭连接。 import java.sql.Connection; import java.sql.SQLException; import org.apache.commons.dbcp.BasicDataSource; public class Start { private static BasicDataSource dbcp = new BasicDataSource(); static{ dbcp.setDriverClassName("com.mysql.jdbc.Driver"); dbcp.setUsername("tim"); dbcp.setPassword("123456");

permgen, but Java VisualVM says “No GC root found”

删除回忆录丶 提交于 2019-12-03 13:51:02
I have a very simple 'Hello world' type web application (Spring 3.2.1, Hibernate 4.1.9) on stopping/restarting the web-app Tomcat 7.0.26 The following web applications were stopped (reloaded, undeployed), but their classes from previous runs are still loaded in memory, thus causing a memory leak (use a profiler to confirm): /myapp I took the following steps: Started JVisualVM Right click on Tomcat and selected 'Heap Dump' Clicked on 'OQL Console' on the [heapdump] Ran this query: select x from org.apache.catalina.loader.WebappClassLoader x Found 4 instances of: org.apache.catalina.loader

Can visualvm connect automatically via JMX to a remote process?

只谈情不闲聊 提交于 2019-12-03 09:28:55
问题 I have a Java process running on a remote machine, and the process sets up some mbeans. I also have jstatd running on that machine as the same user as the Java process. (The mbeans can be set up programmatically or using -Dcom.sun.management.jmxremote... etc, this doesn't appear to make a difference). VisualVM is able to make a jstatd connection to the process, which it discovers automatically, but this means I don't get access to mbeans or, for example, the CPU history chart. Alternatively I