远程 jvisualvm 会话不支持 CPU 和分析

发布于 2024-08-11 19:43:00 字数 596 浏览 2 评论 0原文

当监视远程应用程序(使用 jstatd)时,我既无法分析也无法监视 CPU 消耗。堆监控(假设我不使用 G1)有效。 jvisualvm 提供消息“此 JVM 不支持”。在 CPU 图形窗口中。

我的设置中是否缺少任何内容?谷歌显示的结果很少。

本地环境(Mac OS X 10.6):

java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03-219)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-90, mixed mode)

远程环境(Linux 版本 2.6.16.27-0.9-smp(gcc 版本 4.1.0 (SUSE Linux))):

java version "1.6.0_16" Java(TM) SE
Runtime Environment (build
1.6.0_16-b01) Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)

本地监控如宣传的那样工作。

When monitoring a remote app (using jstatd) I can neither profile nor monitor CPU consumption. Heap monitoring (provided I do not use G1) works. jvisualvm provides the message "Not supported for this JVM." in the CPU graph window.

Is there anything missing in my setup? Google showed very few results.

The local environment (Mac OS X 10.6):

java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03-219)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-90, mixed mode)

The remote environment (Linux version 2.6.16.27-0.9-smp (gcc version 4.1.0 (SUSE Linux))):

java version "1.6.0_16" Java(TM) SE
Runtime Environment (build
1.6.0_16-b01) Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)

Local monitoring works as advertised.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

素手挽清风 2024-08-18 19:43:00

Visual VM 不支持代码和分配的远程分析。这很糟糕,但是如果您想启用 CPU 图形,您可以通过启用 JMX 来实现,

-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=12345

您可能还需要根据您的网络添加一些身份验证设置。 JMX 设置将为您提供 CPU 使用情况和线程状态,以及执行远程 jstack。

可以在此处找到远程版本的功能列表:
Visual VM 功能

编辑
获取最新版本的 Visual VM 1.2.1 并下载 VisaulVM-Sampler。这将从 JMX 连接读取以显示分析信息。

Remote profiling of code and allocation isn't supported by Visual VM. This sucks, however if you want to enable the CPU graph you can do this by enabling JMX with

-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=12345

You may need to add some authentication settings too based on your network. The JMX settings will give you the CPU usage, and thread state, as well as doing a remote jstack.

A list of features for the remote version can be found here:
Visual VM features

EDIT
Get the latest version of visual vm 1.2.1 and download the VisaulVM-Sampler. This will read from a JMX connection to show the profiling information.

做个ˇ局外人 2024-08-18 19:43:00

连接eclipse java程序。

第 1 步:确保您的 Eclipse ->首选项-> Java->安装的 JRE 指向启动 VisualVM 的同一个 jdk。

第 2 步: 确保右键单击 ->运行配置具有以下内容

-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port= 16001

第 3 步:重要的是请遵循以下建议。

https://visualvm.java.net/troubleshooting.html#jpswin2

说明:错误VisualVM 启动后立即显示对话框,提示无法监视本地应用程序。本地运行的 Java 应用程序显示为 (pid ###)。

解决方案:如果用户名包含大写字母,则在 Windows 系统上可能会发生这种情况。在本例中,用户名是 UserName,但 JDK 创建的 jvmstat 目录是 %TMP%\hsperfdata_username。要解决此问题,请退出所有 Java 应用程序,删除 %TMP%\hsperfdata_username 目录并创建新的 %TMP%\hsperfdata_UserName 目录。

还可以尝试JVMMonitor,这是一个不错的 eclipse 独立程序监控插件。

Connecting the eclipse java program.

Step 1: ensure your Eclipse -> Preferences -> Java -> Installed JREs is pointing to the same jdk where you have started the visualvm.

Step 2: Ensure Right click -> Run configuration has the following

-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=16001

Step 3: Importantly follow the below suggestion.

https://visualvm.java.net/troubleshooting.html#jpswin2

Description: An error dialog saying that local applications cannot be monitored is shown immediately after VisualVM startup. Locally running Java applications are displayed as (pid ###).

Resolution: This can happen on Windows systems if the username contains capitalized letters. In this case, username is UserName but the jvmstat directory created by JDK is %TMP%\hsperfdata_username. To workaround the problem, exit all Java applications, delete the %TMP%\hsperfdata_username directory and create new %TMP%\hsperfdata_UserName directory.

Also try JVMMonitor is decent plugin for eclipse stand alone program monitoring.

左岸枫 2024-08-18 19:43:00

是因为远程版本(尽管稍微)比本地版本大吗?

Is it because the remote version is (albeit slightly) greater than the local version?

夜夜流光相皎洁 2024-08-18 19:43:00

我可以通过为 JMX 和 RMI 提供相同的端口号来解决此问题。

-Dcom.sun.management.jmxremote.port=29898 
-Dcom.sun.management.jmxremote.rmi.port=29898

请参阅 为什么 Java 在配置 JMX 时打开 3 个端口?

I'm able to resolve this issue by providing same port number for JMX and RMI.

-Dcom.sun.management.jmxremote.port=29898 
-Dcom.sun.management.jmxremote.rmi.port=29898

See Why Java opens 3 ports when JMX is configured?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文